Java中测试换行符

测试换行符的作用


public class test {
public static void main(String[] args) {
	String mobileMsg = "hh";
	String mobileMsg2 = "hh";
	String mobileMsg3 = "hh";
	mobileMsg= mobileMsg+"该邮件为系统邮件,请勿回复。";
	mobileMsg2= mobileMsg2+"\r"+"该邮件为系统邮件,请勿回复。";
	mobileMsg3= mobileMsg3+"\r\n该邮件为系统邮件,请勿回复。";
	System.out.println(mobileMsg);
	System.out.println(mobileMsg2);
	System.out.println(mobileMsg3);
}
}



输出结果:
hh该邮件为系统邮件,请勿回复。
hh
该邮件为系统邮件,请勿回复。
hh
该邮件为系统邮件,请勿回复。

总结 在windows系统 eclipse中测试 \r \n  \r\n  作用都一样

猜你喜欢

转载自lovemojienv.iteye.com/blog/2382535
今日推荐