Sunday, 7 April 2013

MCQ #13

Question) Given this code what is the output?

class Exam
    protected String level = "Easy";

    public void printLevel()

Class IITExam extends Exam
     private String level = "Difficult";

 IITExam  iitExam = new IITExam();
 iitExam .printLevel();

  • Difficult
  • Easy
Answer) Easy

Explanation) Methods can be overridden not the attributes. Rest is self explanatory.

No comments:

Post a Comment

t> UA-39527780-1 back to top