|
|
Authorized user can see question and answers. Please log in or sign up. 
|
#73. Given: 20. public float getSalary(Employee e) { 21. assert validEmployee(e); 22. float sal = lookupSalary(e); 23. assert (sal>0); 24. return sal; 25. } 26. private int getAge(Employee e) { 27. assert validEmployee(e); 28. int age = lookupAge(e); 29. assert (age>0); 30. return age; 31. }
Which line is a violation of appropriate use of the assertion mechanism?
Show comments for this question (0)
Add comments
Link to this question
|
|
#75. Given: 1. class Bar { } 1. class Test { 2. Bar doBar() { 3. Bar b = new Bar(); 4. return b; 5. } 6. public static void main (String args []) { 7. Test t = new Test(); 8. Bar newBar = t.doBar(); 9. System. out. println(“newBar” ); 10. newBar = new Bar(); 11. System. out. println(“finishing” ); 12. } 13. }
At what point is the Bar object, created on line 3, eligible for garbage collection?
Show comments for this question (1)
Add comments
Link to this question
|
|
|
|
gen. 0.197
|
Server date 05:42 10-01-2009
|
Developed by Zip © 2006
|
|
 |
|
|