티스토리 뷰

반응형

 

오늘부터 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);
	}
}

 

 

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

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

반응형