Static block in Java

In this tutorial, we will learn about Static block in Java. A very important thing about the static block is the static block belongs to class not to instance. That’s why static block only runs once it doesn’t matter how many numbers of instance we create. There are few things to note about the static block

Static block in Java Read More »

Instance block in Java

In this tutorial, we will learn about Instance block in Java. Instance blocks are used to initialize instance variables of the class. These blocks run every time when we create an object of the class. There are few things to note about instance blocks. we do not right any identifier with instance block instance block

Instance block in Java Read More »

Static Keyword in Java

In this tutorial, we will learn about static keyword in Java. The main motive of the static keyword in Java is memory management. We can use static keyword with variable, method and block. An important thing to know that a static method, variable and block can be used without creating an object of the class. Static Variable: To make

Static Keyword in Java Read More »

String in Java

In this tutorial, we will learn about String in Java. Some students think String is a primitive data type like int or char but In java String is a very smart and immutable class which is part of java.lang package. When we right a char sequence it represents the object of String class. Check the following example to

String in Java Read More »

Methods in Java

In this tutorial, we will learn about Methods in Java. A method is a small piece(block) of code which can perform some special task and it only executes when we call this method. The method allows us to reuse code. Here we will learn how to create a Method and How to call a method in

Methods in Java Read More »

Constructor in Java

In this tutorial, we will learn about Constructor in Java. The constructor looks exactly the same as a normal method but there is some difference between constructor and method check these: The contractor has no explicit return type Name of constructor would same as class name We can not make a constructor abstract, static, final, and

Constructor in Java Read More »

Class and Object in Java

In this tutorial, we will learn about Class and Object in Java. We are using the class keyword from our very first tutorial of this series. As we learned in previous tutorials Java is an Object-Oriented programming language. It means we can not write anything(variables and methods) outside the scope of the class. Class is a

Class and Object in Java Read More »

×