Using FileReader causes a compiler error “unhandled exception type FileNotFoundException”

后端 未结 6 1013
傲寒
傲寒 2021-01-15 10:01

Ive read a few threads here that relate the same problem, but the solutions arent working. :/

I use Eclipse, here is my program.

package mypackage;
         


        
6条回答
  •  梦毁少年i
    2021-01-15 10:50

    you can fix it simply declaring that throw this exception. Like this:

    public static void main(String args[]) throws FileNotFoundException{
    
    
            FileReader reader=new FileReader("db.properties");
    
            Properties p=new Properties();
            p.load(reader);
        }

提交回复
热议问题