package chapter04; import java.util.Arrays;
public class oop2 { public static void main(String[] args){
String[] a = {"张三","李四","王五"}; for (String s1 : a) { System.out.println(s1); }
User1[] users = new User1[5]; for ( int i1 = 0; i1 < users.length; i1++ ) { users[i1] = new User1(); users[i1].test(); }
String[] names = new String[3]; names[0] = "zhangsan"; names[0] = "zhaoliu"; names[1] = "lisi"; names[2] = "wangwu";
System.out.println("***************************************"); for ( int i2 = 0; i2 < 3; i2++ ) { System.out.println(names[i2]); }
String[][] b = {{"1","2","3"},{"4","5","6"}}; String[][] c = new String[3][3]; c[0][0] = "123";
for(int row = 0; row < c.length; row++){ for (int col = 0; col < c[row].length; col++){ System.out.println(c[row][col] + " "); } System.out.println(); }
int[] d = {12,21,55,2,61,18,8}; Arrays.sort(d); for (int i1 : d) { System.out.println(i1); } } }
class User1 { public void test() { System.out.println("test..."); } }
|