Features of java:
OOPS:
- OOPs in Java stands for Object-Oriented Programming System.
- It is a programming paradigm that organizes software design around data, or objects, rather than functions and logic.
- Instead of writing a long list of sequential instructions (procedural programming), Java uses OOPs to break down a program into smaller, reusable pieces that mirror real-world entities.
Characteristics of OOP:
Class:
- A Class in Java is a blueprint or template used to create objects.
- It defines the properties (data) and behaviors (methods) that objects of that class will have.
Object:
- An Object in Java is an instance of a class that represents a real-world entity.
- It is used to access the variables and methods defined inside a class.
Abstraction:
- Abstraction in Java is the process of hiding implementation details and showing only the essential features of an object.
- It helps users focus on what an object does rather than how it does it.
Encapsulation:
- Encapsulation is the process of wrapping data and methods into a single unit, usually a class, and restricting direct access to the data.
- It acts as a protective shield that prevents data from being accessed directly from outside the class.
Inheritance:
- Inheritance is a core OOP concept in Java that allows one class to acquire the fields and methods of another class using the extends keyword.
- It represents an “is-a” relationship between classes. ** Polymorphism:**
- Polymorphism means “many forms”, where a single entity can behave differently in different situations.
- In Java, it allows the same method or object to show different behavior based on context.
POP:
Procedural-oriented programming (POP) is a programming style where a computer program is built as a set of step-by-step instructions, routines, and functions that execute in a clear, linear order.
Difference between oop and pop:
Class:
- In Java, a class is a blueprint, template, or prototype used to create objects.
- It is a user-defined data type that groups related data (variables) and behaviors (methods) together into a single logical unit.
Core Components of a Class:
A well-defined Java class typically contains:
Fields (Attributes): Variables that represent the state or properties of the class.
Methods (Behaviors): Functions that define what actions the class can perform.
Constructors: Special blocks of code used to initialize newly created objects.
Conditions for creating classes:
- Create class with meaningful names.
- Class name starts with uppercase.
- No space is allowed.
- No special character is allowed except underscore and dollar symbol.
- Numbers are allowed in mid and end.
Programming Paradigm:
- Java is a multi-paradigm programming language, meaning it is not restricted to just one style of coding.
- While it was originally engineered as a strict Object-Oriented Programming (OOP) language, it has evolved significantly over the years to embrace functional, generic, and concurrent programming models.
Here is the short breakdown of its key paradigms:
Object-Oriented Programming (OOP): The primary model. Everything is structured around classes and objects using concepts like inheritance, encapsulation, and polymorphism.
Functional Programming: Introduced in Java 8. It uses Lambda expressions and the Streams API to write clean, declarative, and loop-free code.
Imperative / Procedural: The traditional step-by-step approach using loops (for, while) and conditionals (if-else) to explicitly control state.
Generic Programming: Uses type parameters (like ) to create reusable and type-safe code for different data types.
Concurrent Programming: Supports multithreading (and modern virtual threads) to run multiple tasks at the same time efficiently.
Difference between imperative and declarative paradigm:



Top comments (0)