java语言概述
练习控制台输出东西,System.out.println输出换行,System.out.print输出不换行。
package com;
public class Test {
public static void main(String[] args) {
System.out.println("hello,唐慧敏。");
System.out.println(args[0]);
System.out.println(args[1]);
}
}
配置参数args:
运行结果:
package com;
public class Test {
public static void main(String[] args) {
System.out.print("hello,唐慧敏。");
System.out.print(args[0]);
System.out.print(args[1]);
}
}
运行结果:
输出由“*”组成的三角形
package com;
public class Test {
public static void main(String[] args) {
System.out.println(" *");
System.out.println(" ***");
System.out.println(" *****");
System.out.println("*******");
}
}
运行结果:
输出符号表情
package com;
public class Test {
public static void main(String[] args) {
System.out.println(" ╭︿︿︿╮ ");
System.out.println(" {/ o o /}");
System.out.println(" ( (oo) )");
System.out.println(" ︶ ︶︶");
}
}
结果:
以上就是java语言概述的详细内容,更多请关注其它相关文章!