Object Oriented Java |
The essence of OOP rests on defining "Classes", and
representations of the classes via objects.
|
Objectives
- Each object possess a "State" and "Behavior".
- Explaining Objects:
- A class name can be used as a type to declare an object
reference variable, the instance of the object will display
properties
- String str1 = "Object Type";
- String in Java is a Class, str1 is a variable
that is instantiated with a value "Object Type",
which is a string.
- Declaring object Class-Name typed-name-variable
- Declaring an object alone "DOES NOT CREATE OBJECT"
- Instantiation of ( realizing an object with a value )
variable,
after declaration, is needed to create and use an object.
|
Step: 1 Create a file with your script editor or simple notepad
Use this Code :
HelloObject1.java.txt
|
Step:2 Compile and Run |
Step 3: Analyzed
- A class name can be used as a type to declare an object
reference variable, the instance of the object will display
properties
- str1 is an Object Type
|
|