Posted in Core Java Interview Questions

Java main method

public static void main (String[] args) public public is access specifier which indicates that main() method can be called outside the class. static static methods…

Continue Reading... Java main method
Posted in Core Java Interview Questions

Write JDBC steps to connect to MySQL database in Java

In order to connect to MySQL database, Follow below steps Load JDBC Driver Create Connection object (By passing url, username and password) Create statement object…

Continue Reading... Write JDBC steps to connect to MySQL database in Java
Posted in Core Java Interview Questions

Can we call run() method of a Thread class?

Yes, we can call run() method of a Thread class but then it will behave like a normal method. To actually execute it in a…

Continue Reading... Can we call run() method of a Thread class?
Posted in Core Java Interview Questions

What are different states in lifecycle of Thread?

Initially when we create a Thread in java program, its state is New. When we start the thread that changes its state from New to…

Continue Reading... What are different states in lifecycle of Thread?
Posted in Core Java Interview Questions

How can we create a Thread in Java?

There are two ways to create threads in Java By implementing Runnable interface By extending the Thread Class Difference between Thread and Runnable Preferred way…

Continue Reading... How can we create a Thread in Java?
Posted in Core Java Interview Questions

What is Synchronization in Java? Explain synchronized keyword.

If multiple threads try to operate on a single Java object simultaneously, it may result in data inconsistency problem (Race Condition). Synchronization in java is…

Continue Reading... What is Synchronization in Java? Explain synchronized keyword.
Posted in Core Java Interview Questions

Difference between User Thread and Daemon Thread

When we create a Thread in java program, it is known as user thread. A daemon thread runs in background and does not prevent JVM…

Continue Reading... Difference between User Thread and Daemon Thread
Posted in Core Java Interview Questions

What is the difference between Process and Thread?

A process is a self-contained execution environment and it can be seen as a program or application whereas Thread is a single task of execution…

Continue Reading... What is the difference between Process and Thread?
Posted in Core Java Interview Questions

Java is Pass by Value of Pass by Reference?

Java is Pass by Value.

Continue Reading... Java is Pass by Value of Pass by Reference?
Posted in Core Java Interview Questions

What is instanceof keyword?

We can instanceof keyword to check if an object belongs to the same class or not.

Continue Reading... What is instanceof keyword?