DEV Community

Chithra Priya
Chithra Priya

Posted on

Java OOPS Concept..

1.Class:

What - Class is a blueprint or template for creating a objects. It defines variables and methods.
Why - To organize code, reuse functionality, and implement OOPS concepts.
How - Define a class using the class keyword. Add variables and methods. Create objects of the class using the new keyword.
Syntax:

class class_name
{
field;
method;
}
Enter fullscreen mode Exit fullscreen mode

2.Local and Global variable:

What is Local Variable - Local variables declared inside the method. It only accessable within that method.
What is Global variable - Global variables are declared outside the method. It can be access outside the method.

Top comments (0)