• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exam Lab Question

 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 20 from Devakas Exam Lab(Practice Exam 3 I think)



This is really confusing me because I can't figure out which method to implement..
Any tips?
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A concrete class can't have abstract methods, so it must implement all the abstract methods from its ancestors. You need to implement both BuildNow() and buildNow() (I'm guessing these are two different methods and not a typo.)
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a typo Ruben.

You need to implement only UDI method.



As Nonc is extend UDI, and UDI is already implemented Buildable buildNow() as Abstract, you have to satisfy only UDI's buildNow() method.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use code tags when you post source code.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it was a typo.

But UDI has not implemented the interfaces methods..It has declared the method as abstract.So it is up to Nonc to implement UDI's buildNow method as well as Buildables buildNow method.But how can it do this?
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is only one method. The abstract class is "overriding" the interface method.
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Duran, Nonc cannot see now Buildable method, as it has been declared as abstract by its implementor class UDI.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is IllegalThreadStateException a runtime exception?
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Duran, and your exam is on Friday, just open K&B 6 book, go to chapter 5 page 382 Table 5-2, here all runtime exceptions are given, also which are thrown by JVM and which are by Programmer, mug up this, make a small diary or note, write down this as a small quiz, it will help you in last hours before your exam.

Make all such notes, at least to see one time before your exam.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh that explains it then...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic