正在加载图片...
this引用 关键字this与对象关联 它用于指示当前对象 public class Test t int xi 明此对象的属 Test(int x)[ 变量x应赋值 thisxEx 传递的 法变 量x的值。 public void showvalue()i System. out. print1n(“x等于 public static void main(string args[])( Testtest new Test(10) test. showValue ( Designed by Chiyong C20059 Designed by Chiyong,©2005 this引用 public class Test { int x; Test(int x) { this.x=x; } public void showValue(){ System.out.println(“x 等于 " +x); } public static void main(String args[]) { Test test = new Test(10); test.showValue(); } } ❖关键字 this 与对象关联 ❖它用于指示当前对象 指明此对象的属 性变量 x 应赋值 为通过构造方法 传递的参数自变 量 x 的值
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有