What Sun ?Oracle has to say :
  • Object : "An object is a software bundle of related state and behavior."
    • Real-world objects share two characteristics:
    • They all have state and behavior.
    • state : object's status status and behavior is what object is doing.
  • Class: "A class is a blueprint or prototype from which objects are created."
  • Inheritance: "provides a powerful and natural mechanism for organizing and structuring your software."
  • Interface: "An interface is a contract between a class and the outside world."
  • Package: A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage.
Creating Object :
  • A variable (space holder) retains the information of a primitive data-type or reference to an object
  • An object is an instance of a particular class.
  • For example, in the following example "String" is class and "str1"
    • String str1 ;// No Object is created
    • str1 = new String ("Hello World");// a sting object is created
  • How to use object!!
    • int count = str1.length();
    • System.out.println("length : " + count);
    • The above will print the length of the string
  • Reference assignment