题目
第一题 :运行的结果
class a
{
public static void main(String[] args)
{
String str ="World";
char[] ch = {'H','e','l','l','o'};
change(str,ch);
System.out.println(str);
System.out.println(ch);
}
private static void change(String str,char[] ch){
str ="Change";
ch[0] = 'C';
}
}
答案:
World
Cello
第二题
解法一
List<Integer> A =new ArrayList<Integer>();
List<Integer> B =new ArrayList<Integer>();
List<Integer> C =new ArrayList<Integer>();
for (Integer i : A) {
if (!B.contains(i)) {
C.add(i);
}
}
解法二
int[] A ={1,3,5,7,9};
int[] B ={1,3,5};
List<Integer> C =new ArrayList<>();
for (int i : A) {
Boolean flag=true;
for (int j : B) {
if (i==j) {
flag= false;
}
}
if (flag) {
C.add(i);
}
}
解法三:
A =[1,2,3,4,5]
B =[1,2,3]
C =[]
for i in A:
if i not in B:
C.append(i)
print (C)
SELECT DISTINCT t1.Id,t1.Name,t1.Salary
FROM yuntong t1 ,yuntong t2
where t1.`Name`=t2.`Name`
AND t1.Salary=t2.Salary
AND t1.Id !=t2.Id
select s.s_name from student s where s_id in (
select sc.s_id from student_course sc right join course c
where c.c_id =sc.c_id
and c.c_name ='Math'
and sc.score>(select sum(score) form student_course)+15
)