aboutobject.java

来自「我自己学习JAVA过程中用键盘敲的代码」· Java 代码 · 共 26 行

JAVA
26
字号
package jerryhfb;
public class AboutObject{
	public static void main(String args[]){
		new AboutObject().test();
	}
	
	public void test(){
		TestedClass a = new TestedClass();
		TestedClass b=a;
		System.out.println("beginning:");
		System.out.println("attribute of a is "+a.getAttribute());
		System.out.println("attribute of a is "+b.getAttribute());
		
		System.out.println("first changes:");
		b.setAttribute(30);
		System.out.println("attribute of a is"+a.getAttribute());
		System.out.println("attribute of b is"+b.getAttribute());
		
		System.out.println("second change:");
		
		a.setAttribute(100);
		
		System.out.println("attribute of a is "+a.getAttribute());
		System.out.println("attribute of b is "+b.getAttribute());
	}
}

⌨️ 快捷键说明

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