Core java
- 01 August
Java program to check Armstrong number
Armstrong number is a 3 digit number which is equal to sum of cube of its digits. For example: 371,153 In this post, we will see how to check for Armstrong number in java. [crayon-674456843cdcb885211310/] When you run above program, you will get following output. [crayon-674456843cdd4017259350/] Please go through Frequently asked java interview Programs for more such […]
- 01 August
Java program to reverse a String
In this post, we will see java program to reverse a String. There are many ways to do reverse a String in java, some of them are: Using for loop Declare empty String reverse. This will contain our final reversed string. Iterate over array using for loop from last index to 0th index Add character […]
- 01 August
How to swap two numbers without using temporary variables in java
In this post, we will see how to swap two numbers without using temporary variables. There are three ways to do it. Java program: [crayon-674456843e706758065201/] When you run above program, you will get following output: [crayon-674456843e709658868160/] Third way is fastest of all. Please go through Interview programs in java  for more such programs.
- 10 July
wait, notify and notifyAll method in java with example
You might have noticed Object class has three final method called wait, notify and notifyAll. These methods are used for inter thread communication. Â Java 5 has introduced executor framework which takes care of inter thread communication for you and internally uses wait, notify and notifyAll but you still require basic understanding of these methods and […]
- 25 June
How to iterate over Map or HashMap in java
In this post, we will see how  can we iterate a map in java. There are four ways of iterating over a map, HashMap or TreeMap. Java HashMap tutorial: HashMap in java How HashMap works in java hash and indexfor method in HashMap hashcode and equals method in java How to sort HashMap by keys […]
- 24 June
How to iterate a list in java
In this post, we will see how  can we iterate a list in java. There are four ways of iterating over a list. For loop For each loop(Java 5) While loop Iterator Below example will help you to understand, how to iterate list in java. I am taking custom object list to understand better 1. […]
- 17 June
Difference between ArrayList and LinkedList in java
One of the common interview question is “What is difference between ArrayList and LinkedList”.Before we actually see differences,let me give you brief introduction of both. ArrayList ArrayList is implementation of list interface. ArrayList is not synchonized(so not thread safe) ArrayList is implemented using array as internal data structure.It can be dynamically resized . LinkedList LinkedList […]
- 16 June
Java Thread Join Example
In this post, we will see about Java thread join method. Thread class’s join() method can be used to stop current execution of thread until thread it joins, completes its task. So basically, it waits for the thread on which join method is getting called, to die.For example: Here when you call t1.join(), main thread […]
- 14 June
Java Thread Sleep
Sleep method of java.lang.Thread is used to pause current execution of thread for specific period of time. Some important points about sleep method are : It causes current executing thread to sleep for specific amount of time. Its accuracy depends on system timers and schedulers. It keeps the monitors it has acquired, so if it […]