JAVA TUTORIAL

Java Intro Java Features Java vs C++ Java Simple Program Java Applet vs Application JVM,JDK or JRE Java Keywords Java Variables Java Literals Java Separators Java Datatypes Java Operators Java Statements Java Array Java String

CONTROL STATEMENTS

Java If-else Java While Loop Java Do-While Loop Java For Loop Java For-each Loop Java Switch Java Break/Continue

JAVA METHODS

Java Method Java Overloading Java Overriding

JAVA CLASSES

Java OOPs Java Classes/Objects Java Inheritance Java Polymorphism Java Encapsulation Java Abstraction Java Modifiers Java Constructors Java Interface Java static keyword Java this keyword

Java OOPs

What is OOPS

OOPS is a programming approach which provides solution to real life problems with the help of algorithms based on real world. It uses real world approach to solve a problem. So object oriented technique offers better and easy way to write program then procedural programming languages such as C, ALGOL, PASCAL etc.

Procedural programming means writing code without objects.

Whereas, object-oriented programming means writing code with objects. It contains data in the form of fields or variables (often known as attributes or properties in java) and functionality code in the form of methods (often known as behavior in java).

Java is an object oriented language which supports object oriented concepts like: class and object. In OOPS data is treated important and encapsulated within the class, object then use to access that data during runtime.

It is the most popular programming paradigm and widely used in the software industry today. It is an extension of procedural programming.

Main Features of OOPS

1. Inheritance

2. Polymorphism

3. Abstraction

4. Encapsulation

As an object oriented language Java supports all the features given above. We will discuss all these features in detail later.

Features of OOPs in Java

Some of the striking features of object-oriented programming system (OOPs model/design) are as follows:

1. Higher priority is focused on Data rather than functions.

2. Objects communicate with each other through functions (methods).

3. An object is a group of data and methods.

4. New data and methods can be easily added whenever needs.

5. A bottom-up approach is adopted in programming design.

6. Programs are divided into the number of entities known as objects.

7. Data cannot move freely out of the object.

Advantage of OOPs Concepts in Java

Some of the major benefits of object-oriented programming in java are as follows:

1. Security: In OOP, Data is encapsulated with methods in the class so that data is protected and secured from accidental modification by other external non-member methods.

2. Effective communication: In OOP, objects can communicate via message passing technique that makes interface descriptions with outside systems much simpler.

3. Easily upgraded: Object-oriented system can be easily upgraded from small to large systems because OOP uses bottom-up approach.

4. Maintenance:  The maintenance of object-oriented code is easier.

5. Reusability: Through inheritance, we can use the features of an existing class in a new class without repeating existing code that saves a lot of time for developers, and also increases productivity.

6. Developing complex software: OOPs is the most suitable approach for developing complex software because it minimizes the complexity through the feature of inheritance.

Application of OOPs in Java

The concepts of OOPs provide many benefits for the programmer to design an efficient program. Due to its reusability feature, it is widely used in many areas. Some of the application areas of OOP are as follows:

1. Real-time systems
2. Object-oriented database
3. Graphical user interface design in the Windows operating system.
4. Artificial intelligence and expert systems
4. Parallel programming
5. CAD/CAM software and in many areas.