Java Reference
In-Depth Information
A.
This code does not compile.
B.
9
C.
-1
D.
81
9.
What is the output of the following code?
1. public class TestDrive {
2.
3. public static void go(Car c) {
4. c.velocity += 10;
5. }
6.
7. public static void main(String [] args) {
8. Car porsche = new Car();
9. go(porsche);
10.
11. Car stolen = porsche;
12. go(stolen);
13.
14. System.out.println(porsche.velocity);
15. }
16. }
17.
18. class Car {
19. public int velocity = 10;
20. }
A.
0
B.
10
C.
20
D.
30
E.
This code does not compile.
10.
What is the output of the following code?
1. import java.util.*;
2.
3. public class DateSwap {
4.
Search WWH ::
Custom Search