3.
Which is true? (Choose all that apply. )
"X extends Y" is correct if and only if X is a class and Y is an interface.
"X extends Y" is correct if and only if X is an interface and Y is a class.
"X extends Y" is correct if X and Y are either both classes or both interfaces.
"X extends Y" is correct for all combinations of X and Y being classes and/or interfaces.
4.
Which are valid declarations? (Choose all that apply.)
int $x;
int 123;
int _123;
int #dim;
int %percent;
int *divide;
int central_sales_region_Summer_2005_gross_sales;
5.
Which method names follow the JavaBeans standard? (Choose all that apply.)
addSize
getCust
deleteRep
isColorado
putDimensions
6.
Given:
1. class Voop {
2. public static void main(String [] args) {
3. doStuff(1);
4. doStuff(1, 2);
5. }
6. // insert code here
7. }
Which, inserted independently at line 6, will compile? (Choose all that apply.)
static void doStuff(int... doArgs) { }
static void doStuff (int [] doArgs) { }
static void doStuff(int doArgs...) { }
static void doStuff(int... doArgs, int y) { }
static void doStuff(int x, int... doArgs) { }
7.
Which are legal declarations? (Choose all that apply. )
short x [];
short [] y;
short [5] x2;
short z2 [5];
short [] z [] [];
short [] y2 = [5];
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
8.
Given:
1. enum Animals {
2. DOG ("woof"), CAT ("meow"), FISH ("burble");
3. String sound;
4. Animals(String s) { sound = s; }
5. }
6. class TestEnum {
7. static Animals a;
8. public static void main(String[] args) {
9. System.out.println(a.DOG.sound + " " + a.FISH.sound);
10. }
11. }
What is the result?
woof burble
Multiple compilation errors
Compilation fails due to an error on line 2
Compilation fails due to an error on line 3
Compilation fails due to an error on line 4
Compilation fails due to an error on line 9
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
9.
Given:
1. enum A { A }
2. class E2 {
3. enum B { B }
4. void C() {
5. enum D { D }
6. }
7. }
Which statements are true? (Choose all that apply.)
The code compiles.
If only line 1 is removed the code compiles.
If only line 3 is removed the code compiles.
If only line 5 is removed the code compiles.
If lines 1 and 3 are removed the code compiles
If lines 1, 3 and 5 are removed the code compiles
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment