下面的哪些程序片断可能导致错误?( )。
A: String s="Gone with the wind";String t;t=s[3]+"one";
B: String s="Gone with the wind";String t="good";String k=s+t;
C: String s="Gone with the wind";String standard=s.toUpperCase();
D: String s="home directory";String t=s-"directory";
A: String s="Gone with the wind";String t;t=s[3]+"one";
B: String s="Gone with the wind";String t="good";String k=s+t;
C: String s="Gone with the wind";String standard=s.toUpperCase();
D: String s="home directory";String t=s-"directory";
举一反三
- 下面的哪些程序片断可能导致错误() A: String s = "Gone with the wind"; String t = " good "; String k = s + t; B: String s = "Gone with the wind"; String t; t = s[3] + "one"; C: String s = "Gone with the wind"; String standard = s.toUpperCase(); D: String s = "home directory"; String t = s - "directory"
- Java中,以下代码会报错会报错的两项是() A: String s = "Gone with the wind"; String t = " good "; String k = s + t; B: String s = "Gone with the wind"; String t; t = s[3] + "one"; C: String s = "Gone with the wind"; String standard = s.toUpperCase(); D: String s = "home directory"; String t = s - "directory";
- 下列定义字符串数组的语法正确的是( )? 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"};
- 定义并初始化一个用于存放我们国家的四个直辖市的数组cityName,四个直辖市为:北京,上海,天津,重庆. 正确的是_________ A: String[] cityName=new String[4]{"北京","上海","天津","重庆"}; B: String[] cityName=new String[]{"北京","上海","天津","重庆"}; C: String[] cityName={"北京","上海","天津","重庆"}; D: String cityName = new String[4] { "北京", "上海", "天津", "重庆" };
- 根据用户在文本框txtName中输入的姓名对Student表进行查询,以下SQL语句定义正确的是__________________。 A: String sql="Select * from Student where Sname="+txtName.getText(); B: String sql="Select * from Student where Sname='"+txtName.getText()+"'"; C: String sql="Select * from Student where Sname like "+txtName.getText(); D: String sql="Select * from Student where Sname like '"+txtName.getText()+"'";