要处理异常try{String db_database=db.read_dataname();}
catch(FileNotFoundException){}

解决方案 »

  1.   

    try{
    String db_database=db.read_dataname();
    }cathch(Excetion E){
    //错误处理
    }
      

  2.   

    我改成
    config.conn db=new config.conn();
    try{
    String db_database=db.read_dataname();
    }
    catch(FileNotFoundException){
    }
    编译以下错误
    D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\clas
    ses\Eclass\News.java:831: illegal start of type
    try{
    ^
      

  3.   

    不好意思,少写1个e
    try{
      ...
    }
    catch(FileNotFoundException e){
    }
    catch(IOException e){
    }
      

  4.   

    illegal start of type是什么错误呀
    什么意思
      

  5.   

    config.conn db=new config().conn();
      

  6.   

    kingfish 谢谢
    不过加了e之后错误还是一样啊
      

  7.   

    illegal start of type 是个什么错误
      

  8.   

    "/"好像是在Linux下才用哟!!!!用"\"时必须"\\",因为JAVA也支持规则表达式了!
      

  9.   

    是用D:\\test.txt ~~~刚才也有个朋友犯同样的毛病~
      

  10.   

    /在windows下可以用的
    一下程序可以调试通用的
    package config;
    import java.io.*;public class conn3
    {public static void main(String[] args) throws FileNotFoundException, IOException
    {
    String dn=read_dataname();
    System.out.println(dn);
    }
    public static String read_dataname() throws FileNotFoundException, IOException
    {
    BufferedReader in= new BufferedReader(new FileReader("d:/test.txt"));
    String dataname=new String();
    String username=new String();
    String password=new String();
    dataname=in.readLine();
    username=in.readLine();
    password=in.readLine();
    return dataname;
    }}
    上面的问题解决了,谢谢!