Question - Static class vs. interface
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
Hi ranchers,
When I read the JSP and Servlet specs, I found some are abstract classes, while others are interface. what's the main difference between these two, besides one is using key extends and the other is using implements? Why do the specifications particularly use abstract classes in one place, and use interface in other places?
I think hard about this question but haven't reach a convincible answere. can anyone help me out?
thank you so much.
When I read the JSP and Servlet specs, I found some are abstract classes, while others are interface. what's the main difference between these two, besides one is using key extends and the other is using implements? Why do the specifications particularly use abstract classes in one place, and use interface in other places?
I think hard about this question but haven't reach a convincible answere. can anyone help me out?
thank you so much.
Lydia<br />~~~~~~~~~~~~<br />I love Italy team.
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
Can somebody transfer this post to the Java In General - Beginners forum, please.
No, really being honest... :roll:
- satya
No, really being honest... :roll:
- satya
Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
Agreed, Satya. Given that anyone studying for the SCWCD developer can be assumed to be a SCJP, this does not appear to be the best forum for this question. Hold steady while we beam you over...
Very funny, Scotty. Now beam their clothes too please
- Peter
PS. The specification uses interfaces almost everywhere for the same reasons that they are a good idea elsewhere: so that you can have wildly different implementations that do the same (conceptual) job in completely different ways. After all, different servlet containers can differ substantially in environment, requirements and architecture.
The few classes in javax.servlet... all have specific reasons to be a class and not an interface: GenericServlet and HttpServlet are convenience classes (implementing the Servlet interface) to save you coding. The Servlet*Stream classes need to be (abstract) classes if only because the java.io streams are classes. Cookie is a class because it's a very self-contained entity with no real need for different implementations. Et cetera.
[ March 17, 2002: Message edited by: Peter den Haan ]
Very funny, Scotty. Now beam their clothes too please
- Peter
PS. The specification uses interfaces almost everywhere for the same reasons that they are a good idea elsewhere: so that you can have wildly different implementations that do the same (conceptual) job in completely different ways. After all, different servlet containers can differ substantially in environment, requirements and architecture.
The few classes in javax.servlet... all have specific reasons to be a class and not an interface: GenericServlet and HttpServlet are convenience classes (implementing the Servlet interface) to save you coding. The Servlet*Stream classes need to be (abstract) classes if only because the java.io streams are classes. Cookie is a class because it's a very self-contained entity with no real need for different implementations. Et cetera.
[ March 17, 2002: Message edited by: Peter den Haan ]
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
| this llama doesn't want your drama, he just wants this tiny ad for his mama Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |






