answersLogoWhite

0


Best Answer

A class is basically a definition, and contains the object's code. An object is an instance of a class. For instance, there is one java.lang.String class, but you can instantiate any number of distinct java.lang.String objects (instances). While a class defines the instance variables than an object has, the instantiated object itself actually contains those variables. So to put it simply: An object is an instance of a class.

User Avatar

Wiki User

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

Wiki User

14y ago

Class

Defines the abstract characteristics of a thing (object), including the thing's characteristics (its attributes, fields or properties) and the thing's behaviors (the things it can do, or methods, operations or features). One might say that a class is a blueprint or factory that describes the nature of something. For example, the class Dog would consist of traits shared by all dogs, such as breed and fur color (characteristics), and the ability to bark and sit (behaviors). Classes provide modularity and structure in an object-oriented computer program. A class should typically be recognizable to a non-programmer familiar with the problem domain, meaning that the characteristics of the class should make sense in context. Also, the code for a class should be relatively self-contained (generally using encapsulation). Collectively, the properties and methods defined by a class are called members.

Object

A pattern (exemplar) of a class. The class of Dog defines all possible dogs by listing the characteristics and behaviors they can have; the object Lassie is one particular dog, with particular versions of the characteristics. A Dog has fur; Lassie has brown-and-white fur.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Class with capitol C" is a final class in the java.lang.Class package with helper methods for classes and interfaces in a running Java application.

Object foo = Class.forName("Foo").newInstance();

While class with lower-case "c" is a reserved keyword used to declare a class in Java.

public class Foo {

// ...

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

* A class is an abstract collection of common data (variables, methods, etc.) * An object is a specific instance of a class. * A method is a set of Java statements (lines of code).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the differences between objects and classes in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why constructor use in java?

To create objects of classes


Did java oriented language works on object?

Java is an object oriented language, and it works with classes and objects.


What is Difference between java and core java?

Java or Java SE comes with the standard library, with all the crazy classes to make life easy. Java Core does not come with most of these classes, so that it is a lot smaller.


Do the primitive datatypes in java have objects?

No Primitive data types do not have objects. As of Java 1.5, all primitive types in Java have "wrapper" classes. These classes serve two purposes: # They keep all type-specific methods together in one place. # They allow primitive types to be used in situations which take advantage of generics (also introduced in Java 1.5).


Why we write java program using classes?

Classes are well organised functions in java which help discriminate between two different functions.


What are sealed classes in java?

Final classes are sealed classes in java I guess.


Differences between Java Applet and Java Beans?

Java applet is a program used to run java applications while beans is a compiler used to design java programs (IDE, GUI) :-) GilbertC


Can always create objects of all types of classes?

Of course, JAVA programming has a stricter syntax format than C++


What are the differences between C and Java reference variables?

Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.


Is there any difference between java and j2SE?

Core Java and J2SE are the same thing, which is the set of classes to be found in the rt.jar package. The classes were just given different names at different stages of the continued revisions to the Java Runtime Environment.


What is difference in use between interfaces and abstract classes in java?

While neither abstract classes nor interfaces can be instantiated in Java, you can implement methods in abstract classes. Interfaces can only define methods; no code beyond a method header is allowed.


Why swing is used in java?

Swing is a package in Java which contains tools for building GUI application. Swing is a part of Java's foundation classes.