全文预览

JAVA程序设计-答案

上传者:蓝天 |  格式:doc  |  页数:18 |  大小:186KB

文档介绍
. out .print("\n"); n++; }}}} 运行结果是:( ) 357 11 13 17 19 23 29 3. 分析下面的程序,写出运行结果: public class Exercises5_3 { public static void main(String args[]) { String str1 = new String(); String str2 = new String("String 2"); char chars[] ={ 'a', ' ', 's', 't', 'r', 'i', 'n', 'g' }; String str3 = new String(chars); String str4 = new String(chars, 2, 6); byte bytes[] ={ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 }; String str5 = new String(bytes); StringBuffer strb = new StringBuffer(str3); System. out .println("The String str1 is"+ str1); System. out .println("The String str2 is"+ str2); System. out .println("The String str3 is"+ str3); System. out .println("The String str4 is"+ str4); System. out .println("The String str5 is"+ str5); System. out .println("The String strb is"+ strb);

收藏

分享

举报
下载此文档