Thursday, 31 August 2017

What is Class Loader ? What are the Types (Hierarchy) of Java Class Loaders

Class Loader is used to load classes and interfaces.


Types of class loader


  • Bootstrap class loader : This class loader is responsible for loading core java API classes like rt.jar Bootstrap class loader is native implementation and so they may differ across different JVMs. Location :- jdk/jre/lib/rt.jar 

Simple Currency Formatter in Java

NumberFormat is the abstract base class for all number formats. This class provides the interface for formatting and parsing numbers. NumberFormat also provides methods for determining which locales have number formats, and what their names are.

NumberFormat helps you to format and parse numbers for any locale. Your code can be completely independent of the locale conventions for decimal points, thousands-separators, or even the particular decimal digits used, or whether the number format is even decimal.

Wednesday, 30 August 2017

Search String in Sorted String Array Using Binary search

Binary Search: Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half. Repeatedly check until the value is found or the interval is empty.


We basically ignore half of the elements just after one comparison.

Wednesday, 23 August 2017

wrapper class in java

why we need wrapper class?

Java is an object oriented language and can view everything as an object. A simple file can be treated as an object, an address of a system can be seen as an object.

"wrapper can be used to convert any data type into object"

The primitive data types are not object they do not belongs to any class they are defined in the language itself that's why Java is not

Monday, 21 August 2017

public static void main (String args [] ) in Java

Main method in java is entry point for any core java program. Remember we are not talking about servlet, MIDlet or any other container based managed java program where life cycle method are provided to control the execution.

public static void main( String [] ar )

public - Java used this