English Русский Contacts Site map Add to favorites
Registration
Login
Master braindump list
New braindumps
Submit a dump
Get latest dump
braindumps.com.ua
flame
3COM (7)
Adobe (1)
BEA (1)
Checkpoint (22)
Cisco (20)
Citrix (21)
CIW (15)
Compaq (0)
CompTIA (51)
CWNA (2)
EMC (2)
Exin (4)
GEJOS (4)
HDI (1)
HP (4)
IBM (13)
Juniper (5)
Linux Prof Institute (LPI) (2)
Lotus (11)
Microsoft (2462)
Network Appliance (2)
Novell (16)
Oracle (423)
PLSQL (1)
PMI (5)
SAS (1)
Sun (87)
Teradata (4)
Login:
Password:
RSS feed

Contacts
Certification links
Links
Authorized users can post comments.
Please log in or sign up.

back to list
Back to main forum
Sun Certified Programmer for Java 2 Platform 1.4 

АвторSubject: Q66
written 28 February 2008 23:33   View profile Jonnik  Edit/Delete  Answer  Answer with quotation
Explanation:
The compilation fails with the above method since the instance of Class Sub which is sub calls the super() in the above method by default which is not implemented in the Super Class. So this generates a Compilation error. To run this program without compilation error and to print the value 2 it must be coded as given:
  1. class Super
  2. {
  3. public int i = 0;
  4. public Super()
  5. {
  6. }
  7. public Super(String text)
  8. {
  9. i = 1;
  10. }
  11. }
  12. public class Sub extends Super
  13. {
  14. public Sub(String text)
  15. {
  16. i = 2;
  17. }
  18. public static void main(String args[])
  19. {
  20. Sub sub = new Sub("Hello");
  21. System.out.println(sub.i);
  22. }
  23. }

Incorrect Answers:
1: The output of 0 will not be provided even if the class is not extended to super as the default value if instance is properly created would be 2
2: The output of 1 will not be provided even if the class is not extended to super as the default value if instance is properly created would be 2
3: The output of 2 will be provided only when the empty super() method exists in Class Super.

Current tread:
back to list

Q66 - Go to question 23:33 28.02.08

back to list
Up ^ gen. 0.154 Server date 10:27 09-01-2009 Developed by Zip © 2006 Up ^
Forum
Start online exam simulation
Master braindump
User braindumps
Main forum
Question comments