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.
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.
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 {
// ...
}
* 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).
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.
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).
Final classes are sealed classes in java I guess.
Java applet is a program used to run java applications while beans is a compiler used to design java programs (IDE, GUI) :-) GilbertC
Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.
To create objects of classes
Java is an object oriented language, and it works with classes and objects.
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.
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).
Classes are well organised functions in java which help discriminate between two different functions.
Final classes are sealed classes in java I guess.
Java applet is a program used to run java applications while beans is a compiler used to design java programs (IDE, GUI) :-) GilbertC
Of course, JAVA programming has a stricter syntax format than C++
Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.
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.
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.
Swing is a package in Java which contains tools for building GUI application. Swing is a part of Java's foundation classes.