Eclipse :: Java :: arrays
pw
public class ar01 {
/**
* @param args
*/
public static void main(String[] args) {
int[] teller;
String[] naam;
int[][] matrix; //array van arrays
teller = new int[5];
naam = new String[100];
matrix = new int[5][10];
teller[1] = 2;
naam[51] = "Luc";
matrix[0][0] = 452;
matrix[0][1] = 453;
System.out.println("Teller :"+teller[1]);
System.out.println("Naam :"+naam[51]);
System.out.println("Matrix :"+matrix[0][0]+"|"+matrix[0][1]);
String[] boeken = {"liefdes romans", "dedectieve romans", "fictie"};
System.out.println("Boeken: " + boeken[2]);
String[] maanden = {"Jan", "Feb", "Maa", "Apr",
"Mei", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
for(int i = 0; i < maanden.length; i++ ) {
System.out.println("Maand: " + maanden[i]);
}
}
}
Run als : java application of SWT application
Resultaat :
Teller :2
Naam :Luc
Matrix :452|453
Boeken: fictie
Maand: Jan
Maand: Feb
Maand: Mar
Maand: Apr
Maand: May
Maand: Jun
Maand: July
Maand: Aug
Maand: Sep
Maand: Oct
Maand: Nov
Maand: Dec
|