像下面的例子里,this指针操作的时候,如果把点换成->,会报下面红字的错。
此行的多个标记
- 标记上有语法错误,删除这
些标记
- Java code
class A{ int x; static int y; void f() { this.x = 100; A.y = 200; }}class A2{ int x; static int y; void f() { x = 100; y = 200; }}class B{ void f() { this.g(); B.h(); } void g() { System.out.println("ok"); } static void h() { System.out.println("hello"); }}class B2{ void f() { g(); h(); } void g() { System.out.println("ok"); } static void h() { System.out.println("hello"); }}
------解决方案--------------------
别把java的语法和c++的语法搞混
java没有指针概念,只有引用
------解决方案--------------------
->java中没有。