| Primitive | Wrapper-Klasse |
|---|---|
byte |
Byte |
short |
Short |
int |
Integer |
long |
Long |
float |
Float |
double |
Double |
char |
Character |
boolean |
Boolean |
System.out.println(Integer.MIN_VALUE == Integer.MAX_VALUE + 1);
System.out.println(0.0/0.0);
System.out.println(1/0);
System.out.println(1/0.0);
System.out.println(Double.POSITIVE_INFINITY/0.0);
int x = 1;
int y = 2;
int z = 3;
System.out.println(x & y);
System.out.println(x | y);
System.out.println((x == y) || (x < z));
System.out.println((x < z) || (x == y));
System.out.println((x < z) | (x == y));
System.out.println((x == y) && (x < z));
System.out.println((x < z) && (x == y));
System.out.println((x < z) & (x == y));
int x = 1;
int y = 2;
int z = 3;
System.out.println((x != y) && (x < z));
System.out.println(x != y && x < z);
System.out.println(true | true & false);
long myLong = 2147483648L; // 2³¹
double myDouble = java.lang.Math.PI;
float myFloat = 2.9F;
byte myByte = 65;
char myChar = 'A';
System.out.println(myLong);
System.out.println((int) myLong);
System.out.println(myFloat);
System.out.println((int) myFloat);
System.out.println(myDouble);
System.out.println((float) myDouble);
System.out.println((byte) myChar);
System.out.println((char) myByte);
java.lang.Math.round() für Konvertierung von Fließkomma zu Ganzzahlclass Coordinates2D {
int x;
int y;
public static void main(String[] args) {
Coordinates2D c = new Coordinates2D();
System.out.printf("c: (%d,%d)%n", c.x, c.y);
}
}
class LocalVariables {
public static void main(String[] args) {
int x, y;
System.out.printf("c: (%d,%d)%n", x, y);
}
}
Coordinates2D c1, c2;
c1 = new Coordinates2D();
c2 = c1;
c2.x = 5;
c2.y++;
c2 = new Coordinates2D();
System.out.printf("c1: (%d,%d)%n", c1.x, c1.y);
System.out.printf("c2: (%d,%d)%n", c2.x, c2.y);
enum Color {
BLACK, WHITE, RED, GREEN, BLUE
}
// Assign enum value
Color background = Color.WHITE;
// Parse String eqivalent of enum member
Color userSupplied = Color.valueOf("BLUE");
Date
Tag, Monat, Jahr
Author
Vor-/Nachname, Geburtsdatum
Document
Titel, Sprache, Veröffentlichungsdatum, Autor
Beantwortet folgende Fragen mittels docs.oracle.com/javase/7
Character.isSpace(char ch)?String s ausgeben?Document-Klasse modellieren?s.substring(2)Math.pow(x, n)java.util.LocaleFrom the Java Code Conventions
- 80% of the lifetime cost of a piece of software goes to maintenance.
- Hardly any software is maintained for its whole life by the original author.
- Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly
