⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aclass.java

📁 初期JAVA学习非常有用的资料。帮助深入了解API。特别是Applet。
💻 JAVA
字号:
public class AClass {    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) {        AClass anInstance = new AClass();        AClass anotherInstance = new AClass();        //Refer to instance members through an instance.        anInstance.instanceInteger = 1;        anotherInstance.instanceInteger = 2;        System.out.println(anInstance.instanceMethod());        System.out.println(anotherInstance.instanceMethod());        //Illegal to refer directly to instance members from a class method        //System.out.println(instanceMethod());    //illegal        //System.out.println(instanceInteger);     //illegal        //Refer to class members through the class...        AClass.classInteger = 7;        System.out.println(classMethod());        //...or through an instance.        System.out.println(anInstance.classMethod());	//Instances share class variables        anInstance.classInteger = 9;        System.out.println(anInstance.classMethod());        System.out.println(anotherInstance.classMethod());    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -