Category: Java

Autounboxing NullPointerException in java

Sometimes while autounboxing, NullPointerException is thrown by JVM. For example, in the below scenarios , NullPointerException will be thrown by JVM while autounboxing. package com.masterjavatutorial; public class AutounboxingNullPointerException { public… Read more »

Comparable Interface in Java

Important Points about Comparable Interface in JAVA: 1.) It is meant for default natural sorting order. 2.) It is present in java.lang package 3.) It contains only one method compareTo()…. Read more »

Search an element in an array

Problem Statement: Given an array a[] = {12,23,45,76,11,2334,655,6767,877,334,346,655}. Find an element 655 in the array. If it exists, print the index of the element in the array. Solution: Simple way… Read more »

do while loop in java

do while loop is similar to while loop but there is some difference between these two. do while loop will execute at least once even if the condition is false…. Read more »