티스토리 뷰

728x90
반응형

 

오늘부터 30일동안 hackerrank challenges에 도전한다

 

오늘은 그 첫번 째날로

Day 0 문제를 풀어보고

코드를 리뷰해보자.

 

Day 0 결과

 

 

 


 

문제가 영어이긴 하지만

예제를 보면 이해하는 데 어려움은 없을 것이다.

 

"Hello, World." 고정 문자열 뒤에

inputString을 출력시켜 주면 된다.

 

문제가 어렵지 않았으니

바로 코드로 들어가보자!

public class Solution {
	public static void main(String[] args) {
        // Create a Scanner object to read input from stdin.
		Scanner scan = new Scanner(System.in); 
        
		// Read a full line of input from stdin and save it to our variable, inputString.
		String inputString = scan.nextLine(); 
        

		// Close the scanner object, because we've finished reading 
        // all of the input from stdin needed for this challenge.
		scan.close(); 
      
		// Print a string literal saying "Hello, World." to stdout.
		System.out.println("Hello, World.");
      
	    // TODO: Write a line of code here that prints the contents of inputString to stdout.
        System.out.println(inputString);
	}
}

 

 

아주 간단한 문제라 이해하는데 어려움은 없을 것이다.

그럼 우리는 다음 포스팅에서 만나자. 😆

728x90
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함
반응형
250x250