Menu
Question Index
...

What will be the output of the following program?

public class Lazy {
    private static boolean initialized = false;
    static {
        Thread thread = new Thread(new Runnable() {
            public void run() {
                initialized = false;
            }
        });
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
                throw new AssertionError(e);
        }
    }
    public static void main(String[] args) {
        System.out.println(initialized);
        System.out.println("http://java.meritcampus.com/");
    }
}


http://java.meritcampus.com/
false
http://java.meritcampus.com/
Some other output
Output can not be determined
Compilation Error or Runtime Error

Doubts

Problems

Topic: What is Multitasking and Multithreading?

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App