package com; public class CreatString { public static void main(String[] args)
{ String a = "时间就是金钱";//直接引用字符串常量 System.out.println(a+"\n"); String b =new
String("爱拼才会赢");//利用构造方法实例化 String c =new String(b);//使用已有字符串变量实例化
System.out.println(b); System.out.println(c+"\n"); char[] charArry=
{'t','i','m','e'}; String d =new String(charArry);//利用字符数组实例化
System.out.println(d); //提取字符数组部分内容,从索引为4的元素开始,截取2个字符 char[] charArry2=
{'时','间','就','是','金','钱'}; String e =new String(charArry2, 4, 2);
System.out.println(e); } }

技术
今日推荐
PPT
阅读数 99
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信