java
JAVA - System.out.println 구현하기
System.out.println() 이 어떤 형식으로 구성되어 있는지 알아볼 필요가 있습니다.
// ex.1)
public class Ex01 {
public static void main(String[] args) {
Misnam system = new Misnam();
system.out.print("문자열 출력");
}
}
class Misnam{
public uPrint out = new uPrint();
}
class uPrint{
public void print(String str) {
System.out.println(str);
}
}
아래는 결과 화면입니다.
다음은 사용자로부터 입력받은 문자열을 출력해 보겠습니다.
// ex.2)
import javax.swing.JOptionPane;
public class Ex06 {
public static void main(String[] args) {
Misnam system = new Misnam();
String str = JOptionPane.showInputDialog("입력하세요.");
system.out.print(str);
}
}
class Misnam{
public uPrint out = new uPrint();
}
class uPrint{
public void print(String str) {
System.out.println(str);
}
}
0 댓글