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
|