浅谈Java中this的使用(转)
                                            
                                                
            浅谈 Java 中 this 的使用(转)[@more@]  1. this是指当前对象自己。
当在一个类中要明确指出使用对象自己的的变量或函数时就应该加上this引用。如下面这个例子中:
 
当在一个类中要明确指出使用对象自己的的变量或函数时就应该加上this引用。如下面这个例子中:
| CODE: public class A { String s = "Hello"; public A(String s) { System.out.println("s = " + s); System.out.println("1 -> this.s = " + this.s); this.s = s; System.out.println("2 -> this.s = " + this.s); } public static void main(String[] args) { new A("HelloWorld!"); } } 文章题目:浅谈Java中this的使用(转) 文章网址:http://www.scyingshan.cn/article/jjjhdp.html | 

 建站
建站
 咨询
咨询 售后
售后
 建站咨询
建站咨询 
 