Hi Prasad

It is certainly not "Point.p ..." but "Point p ...".

As "int n = 30;":
-- defines a variable called "n"
-- of type "int"
-- and initializes it with the value 30,
in the same way "Point p = new Point();"
-- defines a variable called "p"
-- of type "Point"
-- and initializes it with a new instance of the class Point.

Typically, each java file contains the description of a class (having the same case sensitive name as the file name). For example, the file "Main.java" contains the definition of the class Main: "public class Main { ... here is the class definition ...}". Exceptionally, you may define more than one class in a file, but only one "public" (having the same name as the file).

I think the code you sent is an elementary illustration of class instantiation and interaction and, for simplicity, all was put in a unique file.

Hope it helps
Mihai

In fact, you can defines several


Le 28/09/2010 20:54, prasad jedhe a écrit :

Can any one tell me wats happening here...wats the use of "Point.p"...please explain in detail as am new to JAVA

public class Main {

    public static void main(String[] args) {

        Point.p = new Point();
    }
}

class Point{

    static Point p;

      static void m1(int n){
        System.out.println(n);
    }
}



--
To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to