Answer Posted / murthy
A class is neither an object nor an object is a class.
A class is like a blue print for an object.
An object is an instance of a class.
Some people have given the right examples above and some
more goes here:
You can consider a blue print for your house is a class.
You cannot stay in blue print :).
The building built based on the blue print is called an
object. You can stay in it.
Class should be treated like a "data type" and an object
like a instance of that datatype.
for e.g., int i; you can considet int as a class and i as
an instance of an object.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is a default method? Why do we need default methods in java 8 interfaces?
What is a functional interface? What is sam interface?
Is it possible to provide method implementations in java interfaces? If possible, how do we provide them?
What do you mean by polymorphism?
What are the features that are provided to make a program modular?
What are the limitations of oops?
Can we access interface static method using interface references?
Why is OOP good?
What are extrinsic and intrinsic connections in object-oriented programming?
What is the use of interface?
What is a friend function?
Whether static method can use nonstatic members?
What is the benefit of using inheritance?
Can a class in java be inherited from more than one class?
Difference between encapsulation and data hiding ?