您的位置:首页 > 编程语言 > Java开发

test5.14

2015-09-22 15:21 176 查看
/*target:define a class with 2 static String,prove they two are 

 * initialized before used.

 * methods:one is initialized while defined, the other in a static function ,last add a static 

 * function to print these two String.

 */

public class Test14 {

static String s1="Hello ";

static String s2;

static{s2=new String("World !");}

static void show()

{System.out.println(s1+s2);}
public static void main(String[] args) {
Test14 test=new Test14();
test.show();
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Java