Search:

Type: Posts; User: Json

Search: Search took 0.11 seconds.

  1. Replies
    8
    Views
    3,130

    Re: NullPointerException:null problem

    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...
  2. Replies
    8
    Views
    3,130

    Re: NullPointerException:null problem

    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?");
  3. Replies
    8
    Views
    3,130

    Re: NullPointerException:null problem

    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();


    //...
Results 1 to 3 of 3