Created
October 15, 2014 15:11
-
-
Save TPei/7854726ba8a401b4c7b9 to your computer and use it in GitHub Desktop.
Java DEMO Zuweisungen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class A_Zuweisungen { | |
public static void main(String[] args) { | |
// Deklarierung (ohne Wert) | |
int a; | |
int b, c, d; | |
// Initialisierung (mit Wertzuweisung) | |
a = 7; | |
int e = 10; | |
int f = 11; | |
// Variablen ist jederzeit ein neuer Wert zuweisbar | |
a = 11; | |
e = 12; | |
f = 13; | |
// mathematische Ausdrücke (+, -, /, *) | |
// werden enstsprechend der gaengigen mathematischen Regeln | |
// Punkt vor Strich, Klammer zu erst | |
// ausgewertet | |
b = 1 + e; // b => 13 | |
c = a + f; // c => 24 | |
d = 10 + 12 + e; // d => 34 | |
// Wertausgabe in die Konsole | |
System.out.println("a: " + a + ", b: " + b + ", c: " + c + ", d: " + d + ", e: " + e + ", f: " + f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment