public class TestType
{
public int c = 20;
public int a;
public byte b;
public short s;
public long l;
public float f;
public double d;
public char cc;
public boolean bb;
public static void main(String[] args)
{
TestType tt = new TestType();
//局部变量的使用三步:声明,赋值,使用。
int x,y;
x=10;
y=30;
System.out.println(x+" "+y);
//成员变量使用:声明,赋值(如果没有,则使用默认值),使用。
System.out.println(tt.c+" "+tt.a);
System.out.println(tt.b+" "+tt.s+" "+tt.l+" "+tt.f+" "+tt.d+" "+tt.cc+" "+tt.bb);
}
}
|