OOPs concepts in Java basic programming language with details


Oops concepts plays vital role in java basic programming language therefore its very important to learn this concepts in details

Object-objects have States and behaviour. Example: a cat has States-color, name, Breed as well as behavior such as tail waving, barking, eating. An object is an instance of a class.

Class-class can be defined as template/blueprint that describes the behavior/state the object of its type.method is basically a behavior. A class can contain many methods. It is in methods in which the logic is written, data is manipulated and all actions are executed.


Java-Modifier
it is possible to modify classes, methods etc. with modifiers. There are two categories of modifiers
Access modifiers:- Standard, public, protected, private
Non-access modifiers:- final, abstract, strictfp

variables
types of variables in Java
Local Variables
Class Variables (Static Variables)
Instance variables (Non-static variables)









Java Arrays
Arrays are the objects that store multiple variables of the same type. However, an array itself is an object on the heap. In the coming chapters we will examine how to declare, construct and initialize

Java Enums
Enums were introduced in Java 5.0. Enums restrict a variable to one of only a few predefined values. The values in this enumerated list are called as enums.
By using enums it is possible to reduce the number of errors in your code.
For example, if we consider an application for a fresh juice store, it would be possible to limit the size of the glass to small, medium and large. This would ensure that it would not allow anyone to order a size other than small, medium or large.

Inheritance
In Java, classes can be derived from classes. If you need to create a new class and you already have a class that contains part of the code you need, you can derive your new class from the existing code.
This concept allows you to reused the fields and methods of the existing class without having to rewrite the code in a new class. In this scenario, the existing class is called the superclass and the derived class is the sub class

Interface
In Java, an interface can be defined as a contract between objects, how to communicate with each other. Interfaces play an important role when it comes to the concept of inheritance.
An interface defines the methods that should use a derived class (subclass). But the implementation of the methods is totally up to the subclass



For more details:https://www.exltech.in/

Comments

Popular posts from this blog

Dot net basics for beginners

Mechanical design engineer require skills

Creating a career as a mechanical design engineer