Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

I Think this is a really big Bug [CAN'T FIX]

StrawlStrawl ViannaMember Posts: 1

Why is this:`package anger;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;

import javax.swing.JOptionPane;

public class asdf {

public static void main(String[] args) {
    BufferedReader rd;
    boolean iThinkThisIsABug = false;
    try{
        if(iThinkThisIsABug = true)
        {
            rd = new BufferedReader(new FileReader("C:\\users\\Dominik Gyarmati\\AppData\\Roaming\\KeepSafe\\users\\ajd.txt" ));
        }
        else{

        }

}
    catch (FileNotFoundException ex){
        JOptionPane.showMessageDialog(null,ex);

    }

}
}

`
Why is this giving me a FileNotFoundException when the Local Variable is false? This makes no sense to me!

Tagged:

Comments

  • Louis_HonLouis_Hon BudapestMember Posts: 4

    I don't think it's a bug though I'm not familiar with try/catch yet (I'm a beginner). Probably there's a better way to combine if and try blocks (one might ignore the other), Also, shouldn't that equal sign be a double one?

Sign In or Register to comment.