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
Зареєструйся Зараз
або Підпишись на майбутні тести