Let's test your knowledge of the Java language with a little quiz. The answers are included in the first appendix. If you earn a great score, congratulations! If not, don't despair and just reread the relevant parts and see if you can do better next time.
- Will the following code compile? If not, what is wrong with this code?
import java.util.ArrayList;
package com.example.quiz1;
public class Question1 {
}
a) The package name is wrong; digits are not allowed in package names.
b) The ArrayList is not a class in the java.util package.
c) The package statement must be placed before the import statement.
d) None of the other options; the file compiles correctly.
- Will the following code compile? If not, what's wrong with it?
class A { }
class B { }
class C extends A, B {
}
a) Class names with a single...