📄 teststatic.java
字号:
package jerryhfb;
public class TestStatic{
public int instanceInteger=0;
public int instanceMethod(){
return instanceInteger;
}
public static int classInteger=0;
public static int classMethod(){
return classInteger;
}
public static void main(String[] args){
TestStatic anInstance=new TestStatic();
TestStatic anotherInstance=new TestStatic();
anInstance.instanceInteger=1;
anotherInstance.instanceInteger=2;
System.out.println(anInstance.instanceMethod());
System.out.println(anotherInstance.instanceMethod());
TestStatic.classInteger=7;
System.out.println(classMethod());
System.out.println(anInstance.classMethod());
System.out.println(anotherInstance.classMethod());
anInstance.classInteger=9;
System.out.println(anInstance.classMethod());
System.out.println(anotherInstance.classMethod());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -