O'Reilly logo

OCP Java SE 7 Programmer II Certification Guide: Prepare for the 1ZO-804 exam by Mala Gupta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Twist in the Tale 1.3

Let’s modify the code of classes Book and CourseBook and define multiple combinations of static and nonstatic method print() in both these classes as follows:

a  class Book{
       static void print(){}
   }
   class CourseBook extends Book{
       static void print(){}
   }
b  class Book{
       static void print(){}
   }
   class CourseBook extends Book{
       void print(){}
   }
c  class Book{
       void print(){}
   }
   class CourseBook extends Book{
       static void print(){}
   }
d  class Book{
       void print(){}
   }
   class CourseBook extends Book{
       void print(){}
   }

Your task is to first tag them with one of the options and then compile them on your system to see if they’re correct. On the actual exam, you’ll need to verify (without a compiler) if a code snippet compiles or not:

  • Overridden ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required