Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in servlet API

 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I was browsing the Servlet API and i came across the Servlet interface.
There are many functions under the Servlet interface.Some of which are as follows


java.lang.String getServletInfo()
void init(ServletConfig config)
void service(ServletRequest req, ServletResponse res)
Each of these functions have different purposes,Some even return values.

An interface has no method implementations in it.
My Question is:
How can an Interface like Servlet have methods that return value without any implementations in them?Please do reply. Thank you in advane
 
sangram mhatre
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you aware what an interface in java is ?
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
Interface has is a group of method definitions .
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by nidhivel raja:
Yes
Interface has is a group of method definitions .


Sorry for the mistake
Interface is a group of method definitions
 
Vijay Jeyam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet is very generic and abstract. Servlet as a concept is not protocol specific. If you see some implementation for example implementation for HHTP protocol it comes with some implementaion as how to handle that. You can write some implementation that can handle FTP etc that will have the implementation.



The rest will be given by the user who is extending them(..business).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65114
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As with all other interfaces, a concrete class implements that interface. In the case of Servlet, the container defines and instantiates the concrete class.
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Mr.Sangram Mhatre, Mr.Vijay Jeyam and Mr.Bear Bibeault my doubt is cleared now
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic