- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Object and class in Java
When we consider a Java program, it can be defined as a collection of objects that communicate via invoking each other's methods. Let us now briefly look into what do class, object means.
- Object − Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behavior such as wagging their tail, barking, eating. An object is an instance of a class.
- Class − A class can be defined as a template/blueprint that describes the behavior/state that the object of its type supports.
Example
public class Tester { public void message(){ System.out.println("Hello World!"); } public static void main(String args[]) { Tester tester = new Tester(); tester.message(); } }
Here Tester is class and tester is its object.
- Related Articles
- Object class in Java
- Difference between Object and Class in Java
- Object class in java programming
- Method of Object class in Java
- What is the object class in Java?
- Get class from an object in Java
- Difference between Object level lock and Class level lock in Java
- Java Object Creation of Inherited Class
- Get super class of an object in Java
- How to create a class and object in JShell in Java 9?
- Why Object class is the super class for all classes in Java?
- How to create an object from class in Java?
- Listing the Modifiers of a Class Object in Java
- Does JVM creates object of Main class in Java?
- Object level lock vs Class level lock in Java?

Advertisements