Menu
Question Index
...

What will be the output of the following program?

class Book {    }
public class NoteBook extends Book {
    public static void main(String[] args) {
        Class myBook;
        Book b1 = new Book();
        NoteBook b2 = new NoteBook();
        myBook = b2.getClass();
        System.out.println(myBook.getSuperclass());
    }
}


class NoteBook
class Book
Some other output
Compilation Error
Runtime Error

Doubts

Problems

Topic: java.lang.class - Java Library

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App