יום שני, 14 בפברואר 2011

Gridworld: Part 3: Classes & Interfaces: Set 3: Page 19



1.

Location loc1 = new Location(4, 3);
Location loc2 = new Location(3, 4);

How would you access the row value for loc1?  

2.
Location loc1 = new Location(4, 3);
Location loc2 = new Location(3, 4);

What is the value of  b  after the following statement is executed?

boolean b = loc1.equals(loc2);


3.
Location loc1 = new Location(4, 3);
Location loc2 = new Location(3, 4);

What is the value of loc3  after the following statement is executed?

Location loc3 = loc2.getAdjacentLocation(Location.SOUTH);

4.
Location loc1 = new Location(4, 3);
Location loc2 = new Location(3, 4);


What is the value of dir  after the following statement is executed?

int dir = loc1.getDirectionToward(new Location(6, 5));

5. How does the getAdjacentLocation()  method know which adjacent location to return?  



אין תגובות:

הוסף רשומת תגובה