JAVA问题总结之15-多个类之间的调用:
代码:
package java3; public class test1 { public static void main(String[] args){ Pretimive t = new Pretimive(); for (int i=0;i<t.b.length;i++){ System.out.println(t.b[i]); } System.out.print("\n"); t.b[0]=true; t.b[2]=true; for (int i=0;i<t.b.length;i++){ System.out.println(t.b[i]); } System.out.print("\n"); int_10 i1=new int_10(); for (int i=0;i<i1.b.length;i++){ System.out.println(i1.b[i]); i1.b[i]=i; } System.out.print("\n"); for (int i=0;i<i1.b.length;i++){ System.out.println(i1.b[i]); // i1.b[i]=i; } } } class Pretimive{ boolean[] b=new boolean[3]; } class int_10{ int[] b=new int[10]; }
结果:
false false false true false true 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-09 15:23:14