EXAMPLE PROGRAM:
public class Home{
public static void ( String args[]){
System.out.println("hello");
}
}
OUTPUT:
hello
Java Features:
OBJECT ORIENTED PROGRAMMING LANGUAGE:
- OOPS in Java refers to Object-Oriented Programming System, which is built on four main principles:
- Encapsulation,
- Inheritance,
- Polymorphism,
- Abstraction.
- These concepts help Java create modular, reusable, and maintainable applications.
- OOPS (Object-Oriented Programming System) is a programming paradigm centered around objects that contain data (fields) and behavior (methods).
- Java is inherently object‑oriented and uses OOPS to structure programs efficiently.
OOPS Concepts in Java
1. Class
- A class is a blueprint for creating objects. It defines attributes and methods. Example: Car is a class; BMW is an object.
2. Object
An object is an instance of a class.
It has:State (data)
Behavior (methods)
Identity (unique memory reference)
3. Encapsulation
- Binding data and methods together while restricting direct access using access modifiers.
- Achieved using private fields and getter/setter methods.
4. Inheritance
Allows one class to acquire properties and behaviors of another class.
Promotes code reusability.
5. Polymorphism
- Ability of a method or object to take many forms.
- Compile-time polymorphism: Method overloading
- Runtime polymorphism: Method overriding
6. Abstraction
- Hiding internal implementation details and showing only essential features.
- Achieved using abstract classes and interfaces.
CLASS:
- Class is a container. (Blueprint, template.) Syntax:
Class Home{
.......
.......
}
- Class name must be meaningful.
- Class name should start with uppaercase.
class Home{
public static void main (String[] args){
System.out.println("HELLO WORLD!!!!");
}
}
- {Home, System, string} are class in func.
No space between Class name.
Eg: play groundcan use {$, _}
No special char allowed (except:$,_)
Number are allowed at mid or end of Class.
Not at the beginning of the classname.
class Home{
Static string name ="payilagam";
Static int addno=108;
//static keyword is used to store the class information is common for all and it take 1 memory space for whole class
public static void main(String[] args){
System.out.println(Home.name);
System.out.println(Home.age);
}
}

Top comments (0)