Gemeinsames Lernen
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package org.eidecker.oca8lernen.general;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class Primitive {
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ public class Primitive {
|
||||
char c5;
|
||||
byte b9 = 2;
|
||||
|
||||
byte b2 = 'a';
|
||||
|
||||
float f9 = Long.MAX_VALUE;
|
||||
System.out.println("f9: " + f9);
|
||||
|
||||
@@ -112,6 +114,10 @@ public class Primitive {
|
||||
assertFalse(short3 == short4);
|
||||
|
||||
|
||||
Short short5 = new Short((short)127);
|
||||
Short short6 = new Short((short)127);
|
||||
assertFalse(short5 == short6);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -123,3 +129,9 @@ public class Primitive {
|
||||
|
||||
|
||||
}
|
||||
|
||||
class AndereKlasse {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Geht auch aus nicht public-Klasse");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
package org.eidecker.oca8lernen.lastminute;
|
||||
|
||||
import org.eidecker.oca8lernen.lastminute.hilfspackage.KlasseInEinemAnderenPackage;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import org.eidecker.oca8lernen.lastminute.hilfspackage.KlasseInEinemAnderenPackage;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class Kleinigkeiten {
|
||||
|
||||
// Methoden dürfen private final sein (final sinnlos)
|
||||
private final String methode() {
|
||||
LocalTime t1 = LocalTime.now();
|
||||
LocalDate t2 = LocalDate.now();
|
||||
|
||||
t1 instanceof t2;
|
||||
|
||||
|
||||
return "Sinnlos";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -21,7 +30,20 @@ public class Kleinigkeiten {
|
||||
if (false)
|
||||
if (false) System.out.println("0");
|
||||
else System.out.println("1");
|
||||
// else System.out.println("2");
|
||||
// else System.out.println("2");
|
||||
}
|
||||
|
||||
public void variabennamen (int i) {
|
||||
// for (int i = i; )
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeFromArrayList() {
|
||||
List<Integer> iList = new ArrayList<>();
|
||||
iList.add(1);
|
||||
iList.add(1);
|
||||
iList.add(2);
|
||||
iList.remove(new Integer(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -9,13 +9,24 @@ public class StaticSichtbarkeit {
|
||||
Ober ober = new Unter();
|
||||
ober.methode2(ober); // Ober, da zur Compilezeit ausgewählt (Bei Überladen würde nur die Signatur gewählt!)
|
||||
|
||||
Unter.methode2(ober);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface Interface {
|
||||
static void methode2(Ober ober) {
|
||||
System.out.println("Interface");
|
||||
}
|
||||
|
||||
class Ober {
|
||||
static void methode3(Ober ober) {
|
||||
System.out.println("Interface");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Ober implements Interface {
|
||||
|
||||
public static String s = "OberStatic";
|
||||
|
||||
private final void geheimeMethode() {
|
||||
|
||||
@@ -25,11 +36,17 @@ class Ober {
|
||||
System.out.println("Ober");
|
||||
}
|
||||
|
||||
void methode3(Ober ober) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Unter extends Ober {
|
||||
|
||||
public String s = "UnterNichtStatic";
|
||||
|
||||
public void geheimeMethode() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user