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!

Using "throw FileNotFoundException" or "try-catch block"-stil doesnt work

807600Nov 14 2007 — edited Nov 14 2007
Hello,

at one place of my program I load some data from a file....in another class called MSA_Solution I get from my IDE "unreported exception java.io.FNFE, must be caught or declared to be thrown" statement. Its on the row marked "HERE: in the code below...

{code}import java.io.FileNotFoundException;

public class MSA_Solution extends Solution {

HERE -> private MSA_One alignment_1 = MSA_One.getInstance();

private double objectiveSumOfPairs;
private double objectiveAffineGaps;{code}

If I do this:
{code}public class MSA_Solution extends Solution throws FileNotFoundException ...{code}

the warning statement is still there

or if I surround the code with try/cath block even more warning statements appears(illegal start of type, unreported FNFE exception, <identifier> expected)...I guess I cannot use try-catch block for field declarations?

can anybody please help me? how can I correct the code to get rid of the unreported FNFE statement? Thanks a lot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 12 2007
Added on Nov 14 2007
3 comments
171 views