As you guys know that Java is an Object Oriented Programming Language, Java is an important layer of Object. When we define Class in Java's Source Program, we also define some Functions, Methods, and Variables. To create the same Functions, Methods and Variables, Object is created in Java's Source Code.
Object is also an important role in the real world. Object can be anything in real world. Any person, any object or any organism is all objects of Real World.
➧How to Identify Objects :
- How is the object appearing, that is how his Sape and his design are.
- What is the purpose of the object, that is, what is its Behavior.
- Object identification.
Examples :
For example, we have an A.C. Take it. A.C. is an object, and cooling Room is its Behavior, and A.C. The Model number and its serial number is its identification. Without these three things, we have our special A.C. Can not recognize because all A.C. One is the same and the Behavior of all is the same, so it is very important to have the identification of any object. Now let us see how the object is created.
➧Creating Object :
In order to create an object in Java Programming Language, you have to use (new) Keyword. Without the "new" keyword, the object can not be created in Java.
- First, write the name of the class you want to create the object.
- After this, refer to the reference variable, this can be anything but the reference variable, but yes the reference variable should be unique, such as (a, b, c) etc. .
- Then set equal (=) operator.
- After this, write "new" keyword.
- After that, write the name of that class and apply Brackets "()" to semicolon.
For Example :
Here Demo is a class and b is its reference variable. So in this way we can create Object. So let us understand this better through a Java Source Program.
Java Source Code :
OUTPUT : Name : Ashish
Id Number : 5555
Id Number : 5555
➧ Second Method :
Java Source Code :
OUTPUT : Name : Ashish
Id Number : 5555
So friends, I hope to create an object in Java, you must have understood very well. To read all the topics Relaed from Java, read from www.kptechsolution.com website.
Id Number : 5555
So friends, I hope to create an object in Java, you must have understood very well. To read all the topics Relaed from Java, read from www.kptechsolution.com website.
Like this post, If you find Topic useful in this post, so share it with your friends and colleagues on Facebook, Twitter, whatsapp and Google Plus.
Thank You !
Thank You !
Note - Fore more Topics are available in www.kptechsolution.com.
0 Comments