Java – Multi Threading

Multi-threading is a java process of executing two or more threads (programs) simultaneously to utilize the processor maximum.

Multi-tasking:

  • We can implement multi-tasking in two ways.
    • Program(process) based
    • Sub program(thread) based.

Single Threaded application:

  • Every Java application is single threaded by default.
  • The default thread in java is “main thread”
class Code
{
            public static void main(String args[]) {
                        int x=10/0;
            }
}

Exception in thread “main” java.lang.ArithmeticException: / by zero

Scroll to Top