Super klassen en tabellen
Multidimensional arrays
Inheritance
bevat:
overriding
multiple constructors
Multidimensional arrays
tabellen
bevat een x en een y
dubbele []
int [][] i = new int[5][5];
Bijvoorbeeld
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Code
int[][] i = new int[5][5];
int j = 0;
for (int x = 0; x < i.lenght; i++;) {
for (int y = 0; y < i[x].lenght; i++;) {
j++;
i[x][y] = j;
}
}
Super klasse
Inherritance
Klasse bevat andere klasse
Constructor → super();
De groente klas
public class Groente {
public void WatBenIk () {
System.out.println(“Ik ben groente”);
}
}
Boerenkool
public class Boerenkool extends Groente {
public void MijnNaamIs() {
System.out.println(“Mijn naam is boerenkool”);
}
public static void main(String args[]) {
Boerenkool b = new Boerenkool();
b.WatBenIk();
b.MijnNaamIs();
}
}
Voor de if-statement
instanceof
Multiple constructors
Random, seed of geen seed
Multiple constructors
public Klassenaam () {
}
}
public Klassenaam (String s) {
}
public Klassenaam (Integer i, String s){
Override
Functie of methode herschrijven
@Override