lab 9 close #7
This commit is contained in:
21
lab/lab9/Question5/Start.java
Normal file
21
lab/lab9/Question5/Start.java
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Answer to questions.
|
||||
*
|
||||
* - Q4: What happends if you try to use am enhanced for loop?
|
||||
*
|
||||
* - A: The original doors will not be replace. When you use for (Door door :
|
||||
* doors), JVM will copy the value to door (or copy the address). If you set
|
||||
* door = new Door(), the new door will be assigned to that copied object,
|
||||
* istead of the object in array.
|
||||
*
|
||||
* - Q5: What happends if you try to replace more doors than the car has?
|
||||
*
|
||||
* - A: It will throw ArrayIndexOutOfBoundsException.
|
||||
*
|
||||
*/
|
||||
public class Start {
|
||||
public static void main(String[] args) {
|
||||
Door.testDoor();
|
||||
Car.testCar();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user