A: new BufferedWriter(new FileWriter("a.txt"));
B: new BufferedReader(new FileInputStream("a.dat"));
C: new DataOutputStream(new FileOutputStream("a.txt"));
D: new ObjectInputStream(new FileInputStream("a.dat"));
举一反三
- 新建一个流对象,下列( )选项的代码是错误的。 A: new BufferedWriter(new FileWriter("a.txt")); B: new BufferedReader(new FileInputStream("a.dat")); C: new DataOutputStream(new FileOutputStream("a.txt")); D: new ObjectInputStream(new FileInputStream("a.dat"));
- 下列哪个选项是创建一个标识有“关闭”按钮的语句? ( ) A: JTextField b = new JTextField("关闭"); B: JTextArea b = new JTextArea ("关闭"); C: JButton b = new JButton("关闭"); D: JCheckbox b = new JCheckbox("关闭");
- 创建一个标识有“关闭”按钮的语句是( )。 A: JTextField button = new JTextField("关闭"); B: JButton button = new JButton("关闭"); C: JLabel button = new JLabel ("关闭"); D: JCheckbox button = new JCheckbox("关闭");
- 下列方法中,能正确创建 JavaScript 对象的是( )。 A: var txt = new Object[name:"George",price:25] B: var txt = new Object(name:"George",price:25) C: var txt = new Object{name:"George",price:25} D: var txt = new Object({name:"George",price:25})
- 定义并初始化一个用于存放我们国家的四个直辖市的数组cityName,四个直辖市为:北京,上海,天津,重庆. 正确的是_________ A: String[] cityName=new String[4]{"北京","上海","天津","重庆"}; B: String[] cityName=new String[]{"北京","上海","天津","重庆"}; C: String[] cityName={"北京","上海","天津","重庆"}; D: String cityName = new String[4] { "北京", "上海", "天津", "重庆" };
内容
- 0
下列代码中给出正确的在方法体内抛出异常的是( )。 A: new throw Exception(" "); B: throw new Exception(" "); C: throws IOException(); D: throws IOException;
- 1
下列定义字符串数组的语法正确的是( )? A: String[] list = new String[]{"red", "yellow", "green"}; B: String list = new String{"red", "yellow", "green"}; C: String list = {"red", "yellow", "green"}; D: String[] list = {"red", "yellow", "green"};
- 2
下列定义字体对象ft的语句中,正确的是___________。 A: Dim ft As New Font("隶书", 18) B: Dim ft As Font = New Font("隶书", 18) C: Dim ft As Font = ("隶书", 18) D: Dim ft("隶书", 18) As Font E: Dim ft = Font ("隶书", 18)
- 3
下列值不为true的表达式有( )。 A: "john" = = "john" B: "john".equals("john") C: "john" = "john" D: "john".equals(new String("john"))
- 4
下列关于Java数组的代码片段,错误的是( )。 A: int[] a=new int[20]; B: String[] names = new String[3]; C: String[] names = {"Bob", "Achebe", null}; D: int[5] ages = new int[];