My eclipse compiles fine with that, you should be getting a compiler warning though.
You can call statics using "this" as well if you like, during runtime the JVM will just reference the class...
Type: Posts; User: Json
My eclipse compiles fine with that, you should be getting a compiler warning though.
You can call statics using "this" as well if you like, during runtime the JVM will just reference the class...
Here is a scary bit of code for you though.
Try running this.
public class MyClass {
public static void myMethod() {
System.out.println("No null pointer exception?");
Indeed, you have a null reference, when you attempt to call a method on a null reference you will be thrown a NullPointerException.
String myString = null;
myString.length();
//...