源代码:
package team4;
/**
*
* @author 郝子嘉
*
*/
public class Test {
int A=5;
static int B=7;
public static void show(){
System.out.println("实例变量A为"+new Test().A);
System.out.println("静态变量B为"+B);
}
public static void main(String[] args){
Test.show();
Test t=new Test();
System.out.println("A为"+t.A);
}
}
*
* @author 郝子嘉
*
*/
public class Test {
int A=5;
static int B=7;
public static void show(){
System.out.println("实例变量A为"+new Test().A);
System.out.println("静态变量B为"+B);
}
public static void main(String[] args){
Test.show();
Test t=new Test();
System.out.println("A为"+t.A);
}
}