How to Create Object in Java

In this tutorial, we will learn how to create an object in Java with the help of examples. We know that everything is an object in Java. A class is a model or user-defined blueprint for creating objects. It encapsulates…

In this tutorial, we will learn how to create an object in Java with the help of examples. We know that everything is an object in Java. A class is a model or user-defined blueprint for creating objects. It encapsulates…

In Java, we need a variable to store data during the execution of program. Internally, a variable represents a memory location where data is stored. When we use a variable in Java program, we have to declare first it along…

Arguments in Java are the actual values that are passed to variables defined in the method header when the method is called from another method. That is, whenever any particular method is called during the execution of the program, there…

In this tutorial, we will learn how to call a method with parameters in Java. When we call a method, the actual arguments in the method call are passed to the formal parameters defined in the method definition. This process…

We know that a method is a function declared inside a class that contains a group of statements. It is used to perform certain tasks or processing of data in the program to yield the expected results. A method can…

When a block is declared with the static keyword, it is called static block in Java. It is a normal block of code enclosed in braces ({ }) and preceded by a keyword “static”. A static block is also known…

In this tutorial, we will understand about call by value and call by reference in Java with the help of examples. In other words, we will understand how argument values are passed to a method in Java. In Java, all…

So far, we have learned that the members of a class can include variables, methods, constructors, and initializer blocks. However, a class can also contain another class or an interface as its member. Nested Class in Java A class declared…

When a method is declared with the keyword static in its heading, it is called a static method in Java. If not, it is called non-static (or instance) method. A static method is also known as class method because, like…