Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"extends" and "throws" in the same class signature

807600Sep 3 2007 — edited Sep 3 2007
How do you do it?

A class I made throws back an IOException that needs to be declared in the calling class, but that class is a subclass, e.g.:
public Class1 throws IOException
{
     foo.bar();
}

public Class2 extends File
{
     Class1 classTest = new Class1();
}
How do I get Class2 to declare a throw? NetBeans keeps telling me I am missing a curly brace, but I am suspect of these kinds of warnings as they usually indicate something else completely. I've played around with the syntax and even tried getting all googly-moogly, but I can't seem to find anything.

Is it even possible?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2007
Added on Sep 3 2007
10 comments
437 views