kangbazi666

区别:

System.out.println() 输出信息后追加一个换行
System.out.print()输出之后不追加换行

实例:

(1)System.out.println()

 

package tes;

public class OutputTest {
	public static void main(String[] args) {
		String[] st = {"a","b","c","d"};
		for(int i = 0; i < st.length; i++ ){
			System.out.println(st[i]+"");
		}	
	}
}

 

打印效果:

a
b
c
d

(1)System.out.print()

package tes;

public class OutputTest {
	public static void main(String[] args) {
		String[] st = {"a","b","c","d"};
		for(int i = 0; i < st.length; i++ ){
		    System.out.print(st[i]+"");
		}	
	}
}

打印效果:

abcd

  

 

分类:

Java

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2021-08-04
  • 2021-10-23
  • 2021-07-02
相关资源
相似解决方案