Interview
- 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 […]
- 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 […]
- 04 August
print all paths from root to leaf in a binary tree in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. This is 9th part of java binary tree tutorial. In this post, we will see about program to print all paths from root to leaf in a binary tree in java. Below diagram will show all paths […]
- 04 August
Spiral/Zigzag level order traversal of binary tree in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. This is 6th part of java binary tree tutorial. In this post, we will see about Spiral/Zigzag Level Order binary tree traversal in java. Spiral/Zigzag Level Order traversal: Spiral/Zigzag Level order traversal of below tree will be: […]
- 20 July
How to Print Leaf Nodes of a Binary Tree in Java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. 1. Introduction In this post, we will see how to count leaf nodes in a binary tree in Java. Understanding how to count leaf nodes is useful for various applications in computer science, such as calculating the […]
- 20 July
How to Count Leaf Nodes in a Binary Tree in Java
If you want to practice data structure and algorithm programs, you can go through 100+ Java coding interview questions. 1. Introduction In this post, we will see how to count leaf nodes in a binary tree in Java. Understanding how to count leaf nodes is useful for various applications in computer science, such as calculating […]
- 19 July
How HashSet works in java
In this post, we will see about Hashset in java Java HashSet: [crayon-6767b0d028e0a150088861/] 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 […]