阅读下列异常处理的代码,( )是错误的?

分类: 单选题 发布时间: 2024-01-20 20:41 浏览量: 1

阅读下列异常处理的代码,( )是错误的?

A.try(Doctor d = new Doctor()) {}catch(Exception e){}

B.try (FileInputStream is = new FileInputStream("A、txt")){}catch(Exception e){}

C.try(Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root","111")){}catch(Exception e){}

D.try( Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "111"); Statement stmt = connection.createStatement(); ){}catch(Exception e){}

正确答案是A