Let’s learn linear search in java. Linear search in java Linear search is very simple sequential search algorithm. It’s used to search key element in the given array. Here search starts from leftmost element of an array and key element is compared with every element in an array. Search continues until the key element is…

Read More Linear search in java

Let’s learn insertion sort in java. Insertion sort in java Insertion sort sorts elements the way in which we sort playing cards. This sort can be fast when used with smaller arrays. Given an array of elements, let’s sort them in increasing order. So let’s look at sample list of integer elements. We have an…

Read More Insertion sort in java

Let’s learn if else in java. If else in java If else statement executes a block of code where; statements inside “if” executes if condition is true else statements inside “else” execute. Here’s the syntax for if else statement. Syntax: if(condition) { // if condition is true; } else { // if condition is false;…

Read More If else in java

Let’s learn java convert hex to decimal. Java convert hex to decimal In hexadecimal to decimal conversion we are using Integer.parseInt() method. Integer.parseInt() method parses string argument as a signed integer in the radix specified by the second argument. Here’s the syntax. public static int parseInt(String s, int radix) throws NumberFormatException Here’s the program to…

Read More Java convert hex to decimal

Let’s learn garbage collection in java. Garbage collection in java Garbage collection means de-allocating unused objects in memory. Objects which are not used or has no references can be reclaimed. Garbage collector is used to reclaim unused memory automatically. Java handles memory de-allocation automatically since object once created uses some memory in the heap location.…

Read More Garbage collection in java

Let’s learn for loop in java. For loop in java For loop is used to iterate a block of statements multiple times. Use for loop if you know the number of iteration is fixed. Here are three types of loops in java with example, Loops in java executes a group of statements or instructions whilst…

Read More For loop in java

Let’s learn factorial program in java. Factorial program in java Factorial is the product of all integers less than or equal to given number. Denoted as n! For example, 6! = 6 * 5 * 4 * 3 * 2 * 1 = 720 (6! means 6 factorial) 4! = 4 * 3 * 2…

Read More Factorial program in java