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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
package com.github.nuistgy.testarray;
public class Test02 { public static void main(String[] args) { int a[] = {1,2,3}; Student stu[] = {new Student(1001,"Mark"), new Student(1002,"Jhon"), new Student(1003,"Jack") }; int b[] = new int[3]; boolean bool[] = new boolean[3]; String s[] = new String[3]; Student stu_[] = new Student[3]; int c[] = new int[3]; c[0] = 1; c[1] = 2; c[2] = 3; for(int m :c) { System.out.println(m); } } }
class Student{ private int id; private String name; Student(int id,String name){ this.id = id; this.name = name; } }
|