COMPLETE SOLUTION GRADED A+
Any object that can be thown as an Exception must inherit from what class? - ANSWER-
Throwable
n.Can a field declared as type boolean hold a value of 1? - ANSWER-No
n.Can a programmer create his/her own Exception class? - ANSWER-Yes. A programmer can
create their own Exception class in Java.
n.Can a sub-class also be a super-class? - ANSWER-Yes, Java allows this
n.Can a subclass write methods that do not appear in the superclass? - ANSWER-Yes
n.Can an interface be instantiated? - ANSWER-No
n.Can an interface be instantiated? - ANSWER-You can never instantiate an interface in java.
n.Can an interface have fields? - ANSWER-Yes
n.Can two methods in the same class definition file have the same signature? - ANSWER-No
n.Can you declare fields of a class inside a method? - ANSWER-No
, n.create a for loop to execute: Is it possible to create an array in Java where the first row has 5
elements, the second row has 6 elements and the third row has 2 elements? - ANSWER-double
[] [] salaries = new double [NUM_STORES][];
array[0] = new double [5];
array[1] = new double [6];
array[2] = new double [2];
n.Does a super class have to be abstract? - ANSWER-No
n.Does the is-a relationship apply to classes that implement an interface? - ANSWER-No
n.Does the Java compiler compile source code to machine code? - ANSWER-No, It compiles
source code to byte code
n.Does using the import statement make your compiled class file larger? - ANSWER-No
n.Give two reasons for interfaces in the Java language. - ANSWER-To implement a list of
methods and organization
n.How many classes can a class directly inherit from? - ANSWER-1
n.How many classes can a given class extend? - ANSWER-one
n.How many interfaces can a class implement? - ANSWER-Multiple or unlimited
n.How many interfaces can another class implement - ANSWER-As many as needed