Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Charles Lyon's book mock exam 3 question 4

 
Himai Minh
Ranch Hand
Posts: 1398
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p. 60 of Charles Lyon's book,

3. Which abstract class can be extended to create a protocol independent servlet?
D. javax.servlet.GenericaServlet



4. What methods does the abstract class in Question 3 declare, which are not found in any superclasses or implemented interface?
A. public ServletConfig getConfig()
B. public ServletContext getServletContext()
C. public void init()
D. public void init (ServletConfig)
E. public String getInitParameter(String)


For question 4, I think it is refering to interfaces: Servlet and ServletConfig .
But I don't see any init() method or geConfig method declare in the above two interfaces.
I think the answer should be A and C, instead of C only as given in the book.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer should be A and C, instead of C only as given in the book.

getServletConfig() comes from the Servlet interface and that is why it is not a correct answer to this question.
 
Himai Minh
Ranch Hand
Posts: 1398
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , Frits. Thanks .
I thought the question is asking what methods are not defined in Servlet interface and ServletConfig interface.
I don't see any getConfig() method and init() methods defined in both interfaces.

I guess the book has a typo. Option A may have been "getServletConfig" instead.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the book has a typo. Option A may have been "getServletConfig" instead.

or they did that on purpose... I even missed that
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!