java/문법
[java] 출력
ksy123
2022. 3. 7. 04:26
화면에 출력하기 위해서 println()과 print()를 사용하다.
println()
: 출력 후 다음 행으로 이동을 한다.
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
System.out.println("Hello World");
}
}
출력)
print()
:출력 후 다음 행으로 넘어가지 않는다.
public class Main {
public static void main(String[] args) {
System.out.print("Hello World");
System.out.print(" Hello World");
}
}
출력)