Fish Touching🐟🎣

Java Class and Object

Nov 3, 2023

# Java Class

A variable of a class type holds a reference to an object of that class.

# Nested Class


# Java Object

# Overview

To construct an object, you use the new operator, followed by a call to the constructor.

new Greeter("World")

The new operator returns the constructed object, or, more precisely, a reference to that object—we will discuss that distinction in detail in the section on object references.

# Class Vs Object

Class is a user-defined datatype that has its own data members and member functions whereas an object is an instance of class by which we can access the data members and member functions of the class.

# Static

Also called a class variable (in contract to a instance variable)

# What is main static in Java

The main method is static, which means that it doesn’t operate on an object.