static Static variable We all know Java is an object oriented programming language. So, most of the time, first we create an object and then call a method using that object. For example, let’s consider a Human class where we…
Author: kart1c
Pillars of OOP
Today we will discuss 4 pillars of OOP (Object Oriented Programming). Abstraction Encapsulation Inheritance Polymorphism Abstraction Abstraction is a process of hiding implementation details and exposes only the functionality to the user. This means the user will only know what…
Java Constructor
What is a constructor? To understand the constructor, let’s first create an object of a class called Bike. To create an bike object we have called: Bike bike = new Bike(); As you can see, it’s a three step process…
Java Packages
The basic purpose of java packages is to group related classes. To group files in your computer, you might create a folder pictures to keep all image files and another folder videos to store your favorite movies and so on.…
Loops in Java
In programming languages, loops are used to repeat a block of code multiple times as long as some condition is satisfied. For example, let’s consider you have a list of 5 songs and you want to play them all. To…
Decision Making Statements (if, else, switch)
In programming, in some situation, we might want a certain block of code to be executed. In another situation, we might want to execute another block of code ignoring the earlier block. This is exactly what decision making statements do.…
String and Math class
String In Java, String is basically an object that represents a sequence of char values. In other words Strings are objects for storing text values. How can we create a String object? There are two ways – Method Example By…
Java Operators
Java operator is a symbol that is used to perform specific operations on variables and values. Let’s assume you want to add 20 with 30 and assign it to a variable. You might do something like – int result =…
Variable and Access Modifier
What is variable in java? In simple terms, variables are just containers for storing values. In java, those containers must have names and types to specify what type of values those containers are going to hold. In other words, all…
JDK, JRE, JVM
Execution of a Java Program Before understanding the JVM, let’s first understand how a Java source file is executed. First we write the java code and store it with the .java extension. When we compile it, Java compiler (javac.exe) converts…