Menu
Question Index
...

What will be the output of the following program?

public class InnerC {
    public static void main(String args[]) {
        InnerC q = new InnerC();
        q.myMethod();
        MyNest.main("Hello MeritCampus");
    }
    void myMethod() {
        System.out.println("Welcome to the JAVA world");
    }
    static class MyNest {
        public static void main(String st) {
            System.out.println(st);
        }
    }
}


Welcome to the JAVA world
Hello MeritCampus
Welcome to the JAVA world
Welcome to the JAVA world
Welcome to the JAVA world
Hello MeritCampus
Compilation Error or Runtime Error

Doubts

Problems

Topic: Static and Non Static Variables - Static and Non Static Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App