Arrays
This commit is contained in:
35
src/org/eidecker/oca8lernen/general/FunWithArrays.java
Normal file
35
src/org/eidecker/oca8lernen/general/FunWithArrays.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package org.eidecker.oca8lernen.general;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class FunWithArrays {
|
||||
|
||||
@Test
|
||||
public void testArrays() {
|
||||
|
||||
int[] ints = new int[] {1, 3, 4, 6, 7};
|
||||
|
||||
List[] lists = {new ArrayList(), new ArrayList()};
|
||||
|
||||
ArrayList[] arrayLists = {new ArrayList(), new ArrayList()};
|
||||
|
||||
int [] one = {1,2,4};
|
||||
int [][] tow = {one};
|
||||
|
||||
int[][][][] strings = new int[3][3][][];
|
||||
strings[1][2] = new int[][]{{1},{2}};
|
||||
|
||||
System.out.println(strings[1][2].getClass().getName());
|
||||
|
||||
// lists = arrayLists;
|
||||
|
||||
// arrayLists = (ArrayList[]) lists;
|
||||
|
||||
arrayLists[0].size();
|
||||
|
||||
}
|
||||
}
|
||||
20
src/org/eidecker/oca8lernen/general/Loop.java
Normal file
20
src/org/eidecker/oca8lernen/general/Loop.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package org.eidecker.oca8lernen.general;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class Loop {
|
||||
|
||||
@Test
|
||||
public void testLoops() {
|
||||
int i = 1;
|
||||
|
||||
/*do
|
||||
System.out.println("Hallo");
|
||||
while(i == 1);
|
||||
*/
|
||||
|
||||
System.out.println("Hallo");
|
||||
while(true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user