Shortcut Navigation:

Class Test Protected Quiz

What is the narrowest valid returnType for methodA in line 3? ReturnIt public class ReturnIt{returnType methodA(byte x, double y) /* Line 3 */{return (long)x / y * 2;}}

Which is valid in a class that extends class A?A class A{protected int method1(int a, int b){return 0;}}   

Which one creates an instance of an array?

Which two of the following are legal declarations for nonnested classes and interfaces?  
  1. final abstract class Test {}
  2. public static interface Test {}
  3. final public class Test {}
  4. protected abstract class Test {}
  5. protected interface Test {}
  6. abstract public class Test {}

Which of the following class level (nonlocal) variable declarations will not compile?

Which two cause a compiler error?  
  1. float[ ] f = new float(3);
  2. float f2[ ] = new float[ ];
  3. float[ ]f1 = new float[3];
  4. float f3[ ] = new float[3];
  5. float f5[ ] = {1.0f, 2.0f, 2.0f};

Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?

Which is a valid declaration within an interface?