๊ด€๋ฆฌ ๋ฉ”๋‰ด

Coding Planet

level 1. ์„œ์šธ์—์„œ ๊น€์„œ๋ฐฉ ์ฐพ๊ธฐ java ๋ณธ๋ฌธ

๐ŸŽ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ/ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค

level 1. ์„œ์šธ์—์„œ ๊น€์„œ๋ฐฉ ์ฐพ๊ธฐ java

jhj.sharon 2023. 3. 27. 21:42
๋ฐ˜์‘ํ˜•

 
 

  • ์ฃผ์˜ํ•ด์•ผ ํ•  ๊ฒƒ!
  • ==๋Š” ๊ฐ์ฒด์˜ ์ฃผ์†Œ๊ฐ’์„ ๋น„๊ตํ•˜๋Š” ๊ฒƒ์ด๊ณ  equals()๋Š” ๋ฌธ์ž์—ด ๊ฐ’ ์ž์ฒด๋ฅผ ๋น„๊ตํ•œ๋‹ค. ์ด ๋ถ€๋ถ„ ์œ ์˜ํ•  ๊ฒƒ
class Solution {
    public String solution(String[] seoul) {
        String answer = "";
        
        
        for(int i = 0; i<seoul.length; i++){
            if(seoul[i].equals("Kim")){
                
                answer = "๊น€์„œ๋ฐฉ์€ " + i + "์— ์žˆ๋‹ค";
            }
        
    }
        return answer;
}
}
๋ฐ˜์‘ํ˜•
Comments