String字符串是不可修改的,它的连接、取子串、替换都会生成新的字符串,原子符串不变public class Test{ public static void main(String args[]){String str="ABCDEF";str.substring(3);str.concat("XYZ");System.out.print(str);}}程序运行结果:
查看答案
理解引用类型参数传递class Test{public static void main(String[] args){String s1 = "a";String s2 = "b";show(s1,s2);System.out.println(s1+s2);}public static void show(String s1,String s2){s1 = s1 +"q";s2 = s2 + s1;}}程序运行结果:
异常处理的执行过程的理解public class Test {public static void main(String[] args) {try {System.out.println(3/0);System.out.println("你好");}catch(ArithmeticException e) {System.out.println("产生算术操作异常");return;}catch(Exception e) {System.out.println("产生异常 ");return;}finally {System.out.println("执行finally块");}System.out.println("程序执行结束! ");}}程序运行结果:如果除掉程序中两个return语句,程序运行结果:
理解实现Runnable接口创建的多线程资源共享public class Test {public static void main(String args[]) {Target target =new Target();Thread t1 =new Thread(target);Thread t2 =new Thread(target);t1.start();try{ Thread.sleep(1000);}catch(Exception exp){}t2.start();}}class Target implements Runnable{int i = 10;public void run() {i--;System.out.println("i="+i);}}程序运行结果:
Sonia, we are ________ informed, loves her family very much.
A. reliable
B. reliably
C. rely