Java String类 这题啥意思啊,题目都不懂呢。。。
利用String类拼写如下的字符串(1)int[]x={19,20,22,26,29,30,70,80,90};“selectod_idfromt_odwherestat...
利用String类拼写如下的字符串
(1)int [ ] x = {19,20,22,26,29,30,70,80,90};
“select od_id from t_od where station_num = 19 or station_num = 20 … or station_num = 90”
(2) “select od_id from t_od where station_name = ‘ 西直门’or station_name = ‘ 中关村’or station_name = ‘ 国贸’ 展开
(1)int [ ] x = {19,20,22,26,29,30,70,80,90};
“select od_id from t_od where station_num = 19 or station_num = 20 … or station_num = 90”
(2) “select od_id from t_od where station_name = ‘ 西直门’or station_name = ‘ 中关村’or station_name = ‘ 国贸’ 展开
展开全部
你好 代码如下 :
1. String str="";
for(int i =0i<x.length;i++){
str+=x[i];
}
System.out.print(str);
2. String a = "西直门";
String b ="中关村";
String c = "国贸";
String sql="select od_id from t_od where station_name ='"+a+"' or station_name ='"+b+"' or station_name='"+c+"'";
希望能帮到你 谢谢
1. String str="";
for(int i =0i<x.length;i++){
str+=x[i];
}
System.out.print(str);
2. String a = "西直门";
String b ="中关村";
String c = "国贸";
String sql="select od_id from t_od where station_name ='"+a+"' or station_name ='"+b+"' or station_name='"+c+"'";
希望能帮到你 谢谢
展开全部
int[] x = { 19, 20, 22, 26, 29, 30, 70, 80, 90 };
// “select od_id from t_od where station_num = 19 or station_num = 20 …
// or station_num = 90”
String sql = "select od_id from t_od where 1=1 ";
for (int i = 0; i < x.length; i++) {
sql += " or station_num=" + x[0];
}
System.out.println(sql);
// “select od_id from t_od where station_num = 19 or station_num = 20 …
// or station_num = 90”
String sql = "select od_id from t_od where 1=1 ";
for (int i = 0; i < x.length; i++) {
sql += " or station_num=" + x[0];
}
System.out.println(sql);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询