Course Content
Core Java
About Lesson

Java Class

A class in Java is a set of objects which shares common characteristics/ behavior and common properties/ attributes. It is a user-defined blueprint or prototype from which objects are created. It defines the properties (attributes) and behaviors (methods) that objects of that type will have. For example, Student is a class while a particular student named Ravi is an object.

Properties of Java Classes

  1. Class is not a real-world entity. It is just a template or blueprint or prototype from which objects are created.
  2. Class does not occupy memory.
  3. Class is a group of variables of different data types and a group of methods.
  4. A Class in Java can contain:
    • Data member/Fields
    • Method
    • Constructor
    • Blocks
    • Nested Class
    • Interface
access_modifier class <class_name>
{
    data member;
    method;
    constructor;
    nested class;
    interface;
}

Class is declared by the use of class keyword.

Types of Class

  1. Top Level
  2. Nested

Scroll to Top