Menu
Question Index
...

What will be the output of following program?

class Keypad {
    synchronized void hit(double n) {
        for (int i = 1; i < 3; i++)
            System.out.print(n + "-" + i + " ");
    }
}
public class Mer implements Runnable {
    static Keypad key = new Keypad();
    public static void main(String[] args) {
        new Thread(new Mer()).checkAccess();
        new Thread(new Mer()).start();
    }
    public int hashCode() {
        return super.hashCode();
    }
    public void run() {
        key.hit(Thread.currentThread().getPriority());
    }
}


5.0-1 5.0-2
5.0-2 5.0-1
5.0-1 5.0-3
Someother output
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