• 14 June

    Java Thread example

    Thread can be called as light weight process. Java supports multithreading , so it allows your application to perform two or more task concurrently.  Multithreading can be of advantage specially when now a days, machine has multiple CPUs, so multiple tasks can be executed concurrently. Whenever we call main method in java, it actually creates […]

  • ConcurrentHashMap in java
    26 November

    ConcurrentHashMap in java

    ConcurrentHashMap was introduced in Java 5 with other concurrency utils such as CountDownLatch, CyclicBarrier and BlockingQueue. ConcurrentHashMap in java is very similar to HashTable but it provides better concurrency level. You might know , you can synchonize HashMap using Collections.synchronizedMap(Map). So what is difference between ConcurrentHashMap and Collections.synchronizedMap(Map)In case of Collections.synchronizedMap(Map), it locks whole HashTable […]

  • 19 July

    How HashSet works in java

    In this post, we will see about Hashset in java Java HashSet: [crayon-6744712263f3c056257186/] This is one of the frequently asked question in core java interview so in this post, we will see how HashSet works in java.We have already seen How hashMap works in java and also difference between HashMap and HashSet. Lets first see […]

  • 11 July

    Difference between sleep and wait in java

    One of the common interview question is “What is difference between sleep and wait in java”.Before we actually see differences,let me give you brief introduction of both. sleep 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, […]

  • 10 July

    How to find prime factors of a number in java

    In this post, we will see how to find prime factors of a number in java. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The prime factors of a number are all of the prime numbers that will exactly divide the given number. […]

  • 09 July

    Palindrome program in java

    In this article, we will see how to implement palindrome program in java. A palindrome is a word, phrase, number, or other sequence of symbols or elements that reads the same forward or reversed. For example: 12121 is palindrome as it reads same forward or reversed. madam is also a palindrome . This is very […]

  • 09 July

    java program to check prime number

    This is easy question. It may not be asked you directly, but you can use this program to create many other complex program. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Program logic: If any number which is not divisible by any other […]

  • 07 July

    Reverse a linked list in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to reverse a linked list in java. This is one of popular interview question. Java Linked List Interview Programs: How to reverse a linked list in pairs How to […]

  • 06 July

    Find nth element from end of linked list

    This is one of popular interview question. Java Linked List Interview Programs: How to reverse a linked list in java How to reverse a linked list in pairs How to find middle element of linked list in java How to detect a loop in linked list in java Find start node of loop in linkedlist […]