This is a jbuilder problem. Put the try-catch around the anonymous class and
compile with just good ole javac, it works.

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of David
Vasquez Estrada
Sent: Thursday, June 07, 2001 11:37 AM
To: [EMAIL PROTECTED]
Subject: Re: Overridden a method


Hi Geeta,


> Please correct me if I misunderstand you, but here's what it seems you are
doing:
>
> 1. Create a class MyClass with a public method myMethod and a constructor
which
> throws an exception.

correct

> 2. Create an *object* oneclass of class MyClass. You havent stated that
oneclass is
> actually of class MYClass but i assume it has to be since you are using
MyClass's
> constructor.

correct

> (I don't see any inner or subclass here and therefore fail to see what
> overriding you are talking about..)

Well,  the problem is that I need to override a method of the class MyClass,
creating
an anonymous class, if the constructor of this class does not throws an
exception, I
can do the following with out problems:

    oneclass=new MyClass("Test", 1)
    {
        public int myMethod(int i) {return i++; }
     }

But, if the constructor throws an exception the code above is not correct
for the
compiler, even if I make the following:

try{
    oneclass=new MyClass("Test", 1)
     {
        public int myMethod(int i) {return i++; }
     }
}
catch(Exception e){
//deal with the exception here..
}

I don't why this is not possible, and there is no documentation about that.

David

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to