What happens at compile-time and running this code?

class MyThread extends Thread {
    public void run() {
        System.out.print("Running ");
    public void start() {
        System.out.print("Starting ");

public class Q202 {
    public static void main(String[] args) {
        MyThread t = new MyThread();
When you run the stream start() method the run() method is called of this stream. Since the start() method is overridden and there wasn't an explicit call to run() method, therefore nothing else will be performed.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Зарегистрируйся сейчас
или Подпишись на будущие тесты