hi
whatever i have got of your query,i am replying that.
we will take the 2nd part first.
//instance member
//-this is a comment entry in java which is totally ignored by the compiler .
in the book this has been given for u to understand that it is an instance variable
//-is a one line comment entry
multiple lines comment entries are written thru
/*
this would
be ignored by the
compiler
*/
i hope that was ur query
now coming to the first part
when we say
print p=new print();
this can be written in 2 steps as well
1)print p;
2)p=new print();
the first line just creates a variable p of class type print.
here as we know a class is nothing but a user defined data type
so p is a variable of type print.here it is not referring to anything.it is just a variable pointing to null.
in the 2nd line
p=new print();
now an object has been created and the reference p is referring to that object of type print.
it is important to understand that there is a difference b/w a reference and an object.
whenever an object is created,the constructor of the specific class is called and memory is allocated.
the reference just points to that object and whenever we use any fn. or variable of that class ,we do that by using the reference of that object.
i hope i have given a valid reply.
ranch hands ,please correct me if i am wrong or incomplete