4 Pillars of OOPs in Java

As programmers work with real-life entities, object-oriented programming allows programmers to achieve the same. Objects are used to store knowledge, data, task, state, and other different OOP tasks and methods.  This article is going to explain the fundamental four pillars of object oriented programming in java. Image Source 1. Encapsulation Encapsulation is achieved when the object of the class maintains the private state. Other objects are not allowed to access these objects; despite that, the other objects can only access

Read more

Advantages and Disadvantages of Inheritance in Java

Inheritance is one of the pillars of the Java programming language. Learning OOP (Object Oriented Programming) without knowing and understanding the concept of Inheritance, its pros and cons are incomplete. Inheritance is a process in which a class acquires all the data members and its parent class methods. The basic idea behind it is that you create new classes based on the existing classes with additional data and methods. Example:

In the above example, there are two classes SuperHello

Read more

Java 3D Array – Three Dimensional Array

When you want to store a student’s list from a class and suppose the class consists of 100 students. By putting the data one by one into a variable will be time taking. While working with those variables and working with variables seems quite complicating and annoying. Therefore to avoid such a situation, an array is introduced, which can store data in a regular format. It is because of the array that operating on data became more accessible. First, get

Read more

Does Constructor Return Any Value?

To find out whether constructor returns any value or not, let’s learn about a constructor? In simple terms, the constructor is a special method, which is used to initialize an instance of a class. This special method differs from the actual methods of classes. The name of a constructor is always similar to the name of the class. Below is an example of a constructor:

How Constructor Work? Consider an example:

OUTPUT: Hello constructor The object is built

Read more

Basic Structure of Java Program with Example

Java is a very popular language and used on 7 billion devices worldwide. It is one of the most secured, platform-independent, and object oriented programming languages that’s why it is necessary to be familiar with the basic structure of Java program. A typical Java program consists of the following sections: Package statements Documentation Section Import statements Class definition Interface statements Methods Main method class Basic Structure of Java Program Image Source Package Statements It is optional to write in your

Read more

What is Native Method in Java?

Java uses various concepts to maintain privacy, structural format, and handling data efficiently, and many others. From all these concepts, one is to increase portability. To make the programs in Java more portable across all the platforms, the Java native interface (JNI) concept comes into the frame. JNI give out a bridge between Java and other native application. JNI is a segment of JDK (Java Development Kit), where JDK prefaces the java bytecode and the native programs (C and C++)

Read more

Why main method is static in Java?

One of the well-establish and most common programming languages is Java. Java came into existence in 1995. And to that date, C and C++ languages consistently widespread in the world of computer science. The ambition to make Java is to build familiarity, security, and portability of data. The main reason to make Java language is to make application programs independent of the hardware system to which the program is running. JVM (Java virtual machine) comes under the category of Abstract

Read more

Difference between Constructor and Method in Java

Java is an Object-Oriented Programming language. Therefore, the data and the member functions in Java are present in the classes. The classes in Java contain both constructors and methods as well. Let’s see in detail about methods and constructors and their differences. Constructor The purpose of constructors is to initialize the objects, which are the instances of the classes. Similar to the methods, the constructors also hold statement blocks that get executed during the run time of the program. Constructors

Read more
1 2 3 4 5 25