answersLogoWhite

0


Best Answer

An object is an _instance_ of a class. A good example is to think of a class as a blueprint for a house, whereas an object is the actual house. You can have many, many houses (objects) build from the same blueprint (class)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

An object is an instance of a class. (in the same way that Garfield is an instance of a cat)

Such that, if class is:

class MyClass {

public:

int x;

};

Then an object would be:

int main()

{

MyClass my_object;

}
A class creates multiple objects. It's kind of like a class is a blueprint and an object is a house; a blueprint can create multiple houses. You can create an object using a class using the following code snippet:

// Assume Foo is the name of a class

Foo foo = new Foo();

After that code is run, a shiny new Foo object will be created, accessible under the reference variable "foo".

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

A class is a set of methods grouped together. An object is an instance of a class whose constructor method sets aside a block of memory to store data.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In java what is the difference between an object and a class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Major difference between c and java?

Java is object oriented, C is not...


What is the difference between java and object oriented programming?

java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.


What is the Object class parent?

Object is the topmost class in the Java Class hierarchy. There is no Class above Object. All classes in Java are implicitly derived from Object.


Is there class name as object in java?

Yes, the base class for all other Java classes is Object.


What is object class in java?

object class is a super class for all other class...


What is topleval class in java?

The top level class in Java is "Object." All other classes are subclasses of Object by default.


Difference between java and C plus plus?

java is an advanced object oriented programming language than c++


The top most class in java?

All classes in java must inherit from the Object class


What are the different between'a' and ''a in java string methods?

The difference between 'a' and "a" anywhere in Java is that 'a' is a primitive char type, while "a" is a String object.


What is static java most commonly used for?

Static java method is the same as a static variable. They belong to a class and not an object of that class. If a method needs to be in a class, but not tied to an object, then one uses static java.


Why you start java program by class?

without class non of the folder can run so the java program should start in class we can use the class without object in java


What is parent class in java?

Object Class is the parent class of all classes in java.Every class in the Java system is a descendant (direct or indirect) of the Object class.