Learn Pain Less

HomeOur TeamContact
Java
What is an Object in java programming
Pawneshwer Gupta
Pawneshwer Gupta
February 06, 2015
1 min
What is an Object in java programming

Objects means which point out property of anything. for example dogs,cats,human.object can be used to define different states of anything. for example:

  • Cycle is a thing and it have some properties like : handle,seat,wheels. And the same way objects are in JAVA. Objects are used to determine state of Anything. For example Cycle is Running, so Running is property of a Cycle and Cycle is Object.

In JAVA or other programming language Objects are similar as real world things, Objects have some states. Objects are used to operate a class. And you know Class is Collection of Variables, Methods etc. To access that Variables and Methods we need to create object of a Class. We can access methods and Variables of class without help of Variables.

But we can use “static” keyword to make Methods and Variables accessible by other classes without creating object of a class. I will discuss in deeply about “static” keyword. But for know you can say that using “static” keyword we can make a methods fixed.

In programming language Object is an Instance of a Class. which is used to access methods and Variables of a class outside that class.

An Object is reference to Class. We need to create Object to call methods of a Class into another class or main method. We cannot call variables or methods of a class without creating an Object of that class. But if variables or methods are static then we can access them without creating Objects. Variables are also an Object. When we declare a variable that time we are creating a reference of a class which is called as variables or Object of that data type or class. We can create Object of built in classes like String, Integer etc and we can also create an Object of our custom class to.

For example:

class First{
public static void main(String[] args){
String s = "Example of Object";
System.out.println(s);
}
}

and the output will be

Example of Object

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.

Tags

startclassobjecthow tojava

Share


Pawneshwer Gupta

Pawneshwer Gupta

Software Developer

Pawneshwer Gupta works as a software engineer who is enthusiastic in creating efficient and innovative software solutions.

Expertise

Python
Flutter
Laravel
NodeJS

Social Media

Related Posts

Working with Files, Folders java
Working with Files, Folders java
March 25, 2015
1 min
Learn Pain Less  © 2024, All Rights Reserved.
Crafted with by Prolong Services

Quick Links

Advertise with usAbout UsContact Us

Social Media