Member • Oct 15, 2014
Object and instance in java
1. A sup;
2.A sup=new A();
Then just tell whether I am correct or not,According to me ,the first line indicates that there is a reference variable sup which is allocated in memory,and it is having value null.
And if I talk about 2 line then there is a creation of object and its reference value would be given to reference variable sup,so actually what is instance,as it is said that "an object is an instance of class",so is it that the line new A();is representing an object and instance both or is there some marginal difference between them.