码迷,mamicode.com
首页 > 其他好文 > 详细

输入输出

时间:2020-01-14 14:43:28      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:输入输出   main   span   font   out   str   ring   div   nbsp   

1.输入

 

2.输出

2.1.println方法

  每次调用println都会在新的一行上显示输出。

1 public class Main {
2     public static void main(String[] args) {
3         System.out.println("123");
4         System.out.println("456");
5     }
6 }
1 123
2 456

2.2.print方法

  输出之后不换行。例如,System.out.print("Hello");打印“Hello”之后不换行,后面的输出“World”紧跟在字母“o”之后。

1 public class Main {
2     public static void main(String[] args) {
3         System.out.print("Hello");
4         System.out.print("World");
5     }
6 }
1 HelloWorld

输入输出

标签:输入输出   main   span   font   out   str   ring   div   nbsp   

原文地址:https://www.cnblogs.com/yangyh26/p/12191860.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!