在只有try-catch语句中,如果catch块中出现了return语句或者抛出了异常,那么catch之后的语句是执行不到的:但是如果将代码放入finally中,即使catch中出现了return语句或者抛出了异常,finally中的代码仍然是可以执行到的.看下面的程序: public class Test { public static void main(String[] args) { // TODO Auto-generated method stub System.out.printl…
首先贴出测试用例: package test; import org.junit.Test; /** * Created by Administrator on 2015/9/16. * */ public class TestString { String str1 = "hello quanjizhu"; //若String pool中没有,则创建新对象,并放入String pool String str2 =str1+"haha"; //由于string不可变…
第一节 String类型的方法参数 运行下面这段代码,其结果是什么? package com.test; public class Example { String str = new String("good"); char[] ch = { 'a', 'b', 'c' }; public static void main(String[] args) { Example ex = new Example(); ex.change(ex.str, ex.ch); System.out…