Nested While Loop in Java

It is pretty impossible to impose hundreds of words or numbers by just writing or putting into variable one by one. Instead, use a loop to avoid extra time. This article gives an overview of nested while loop in Java and how to use them. Why use loops? Loops are the programming structure of an operation that repeats in a specific sequence until the particular condition or procedure is completed. Loops follow the don’t repeat yourself (DRY) principle for complete

Read more

Java Race Condition with Example

Sometimes, people detect some error in the program’s compile-time or run time, which mainly occurs due to race condition while executing programs. Are you excited to know more about race condition? This article will give a piece of detailed information on Race conditions in Java. Before proceeding to know about a race condition, let’s focus on threading. This will help you to understand the basics of race conditions. What is a thread, and why is it used? In java circumstances,

Read more

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

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
1 2