본문 바로가기

Algorithm/Language Coder

Jungol (Java) - 605 : 문자열2 - 자가진단4

문제

문자열을 선언하고 다음과 같이 "Hong Gil Dong"이라는 이름을 복사하여 저장한 후 출력하는 프로그램을 작성하시오.

 

출력 예

Hong Gil Dong

 

public class Main {
    public static void main(String[] args) {
        String str1 = "Hong Gil Dong";
        String str2 = new String(str1);

        System.out.println(str2);
    }
}