Java OCA OCP Practice Question 3259

Question

Consider the following program:

class base1{}//  ww  w .  j  ava2s.  co m

class base2{}

interface base3{}

interface base4{}

// Stmt
public static void main(String args[]){
     }
}

Which one of the following statements will compile without errors if replaced in place of the line marked with comment Stmt?

  • a) class Test extends base1, base2 implements base3, base4 {
  • b) class Test extends base1 implements base3, base4 {
  • c) class Test extends base1 implements base3 implements base4 {
  • d) class Test extends base1, extends base2 implements base3, base4 {


b)

Note

You can extend from only one base class (since Java does not support multiple class inheritance).

However, you can implement multiple interfaces; in that case, the list of implemented interfaces is separated by commas.




PreviousNext

Related