In Java, interfaces have *only* method signatures. What you're trying to do
looks like an abstract class, although an abstract class of this type has
limited usefulness.
What you probably REALLY want to do (note the "probably" -- what you REALLY
want to do is REALLY up to you and you only, REALLY) is define a parent
class, containing a set of common methods, marked as abstract. Then all
classes that need those methods would extend that class, and you'd have your
printError() method automatically.
Incidentally, printError() is probably done a lot better by libraries such
as log4j ( http://jakarta.apache.org/log4j/ ) and other similar creations.
I'm still trying to find the relevance to JSP in your post, and I imagine
I'll fail now, tomorrow, and the day aft... oh, heck, I'll just go ahead and
give up with that now.
>From: drew w <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: simple interface error
>Date: Fri, 4 May 2001 20:02:40 -0000
>
>I am creating a simple interface called common:
>public interface Common{
>public String printError(String msg){
>String errmsg;
>errmsg = ("Sorry "+getName()+",
>"+msg);
>}
>}
>when I compile I get this message:
>Abstract and native methods cannot have a body: String printError(String
>msg)
>public String printError(String msg)
>^
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>http://java.sun.com/products/jsp/faq.html
>http://www.esperanto.org.nz/jsp/jspfaq.html
>http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets