What is the difference between Object and Instance?
Answers were Sorted based on User's Feedback
Answer / siva
instance means non-static variables memory location. Object means non-static variables + non-static methods memory location
Is This Answer Correct ? | 11 Yes | 1 No |
For example, if I declare a class like
Animal a=new Animal();
Is variable 'a' in above is an instance which has an object of Animal type?
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / subba reddy
object means.
just create variable for class this is also called reference.
instance means.
create object for the class using new operator or new instance .
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / nagarjuna
Object is the creating memory location by using new operator
Instance is the creating the reference.
Is This Answer Correct ? | 1 Yes | 4 No |
Answer / srinivaskumar.nimmana
All objects except array object are instances,i.e every object except array object can be instance but every instance may not be object.
Is This Answer Correct ? | 1 Yes | 6 No |
extending thread class or implementing runnable interface. Which is better? : Java thread
How to display all the prime numbers between 1 and 100
What are serialization and deserialization?
Explain about the select method with an example?
Given: 10. interface A { void x(); } 11. class B implements A { public void x() { } public voidy() { } } 12. class C extends B { public void x() {} } And: 20. java.util.List list = new java.util.ArrayList(); 21. list.add(new B()); 22. list.add(new C()); 23. for (A a:list) { 24. a.x(); 25. a.y();; 26. } What is the result? 1 Compilation fails because of an error in line 25. 2 The code runs with no output. 3 An exception is thrown at runtime. 4 Compilation fails because of an error in line 20.
What is anagram of a string?
Difference between flush() and commit() in hibernate?
What is navigable map in java?
What is a resource leak ?
Howmany number of objects we can store in an ArrayList. Is there any limit?
Difference between abtsract & final
What are the various access specifiers in java?