STUDY ๐Ÿ“š/Java

String๊ณผ Char์˜ ์ฐจ์ด - char๋Š” ๋ฌธ์ž, String์€ ๋ฌธ์ž์—ด - String์€ ํด๋ž˜์Šค๋ผ๋Š” ์ ๊ณผ char๋Š” ๊ธฐ๋ณธํ˜• ํƒ€์ž… - String๊ณผ char์˜ ์ฐจ์ด์  ์ค‘ ์ถ”๊ฐ€๋กœ๋Š” String์„ ์ถœ๋ ฅํ–ˆ์„ ๋• ๋ฌธ์ž ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•œ๋‹ค๋Š” ๊ฒƒ์ด๊ณ , char๋Š” ์ž์นซํ•˜๋ฉด ์ •์ˆ˜๋กœ ๋‚˜ํƒ€๋‚œ๋‹ค๋Š” ๊ฒƒ package org.example; public class Main { public static void main(String[] args){ Person p1 = new Person(13); Person p2 = new Person(13); System.out.println(p1); System.out.println(p2); System.out.println("p1 == p2 : " + (p1 == p2)); // ๋ฆฌ๋ชจ์ฝ˜ ๋ผ๋ฆฌ..
โœ… ๊ณต๋ฐฑ์€ ๋ฌธ์ž์—ด ์•„๋‹ˆ๋ผ์„œ false ์ถœ๋ ฅ package org.example; public class Main { public static void main(String[] args) { System.out.println(isHanguel('์•ˆ')); //true System.out.println(isHanguel('๋…•')); //true System.out.println(isHanguel('ํ•˜')); //true System.out.println(isHanguel('์„ธ')); //true System.out.println(isHanguel('์š”')); //true System.out.println(isHanguel('.')); //false System.out.println(isHanguel(' ')..
or , and ๊ฐ€ ๋ญ˜๊นŒ! ๐Ÿ’ก|(๋˜๋Š”, or) (์€)๋Š” ์ขŒ์ธก์‹๊ณผ ์šฐ์ธก์‹ ์ค‘ ํ•˜๋‚˜๋ผ๋„ ์ฐธ์ด๋ฉด ์ฐธ์ด๊ณ , ๋‚˜๋จธ์ง€ ๊ฒฝ์šฐ์—๋Š” ๊ฑฐ์ง“์œผ๋กœ ๊ฒฐ๋ก ์ด ๋‚œ๋‹ค.(ํ™˜์›๋œ๋‹ค, ํ˜น์€ ๋ณ€ํ•œ๋‹ค) // == : ๊ฐ™๋‹ค. // != : ๋‹ค๋ฅด๋‹ค. if ( 10 > 20 || 1 != 1 || 3 > 2 ) { // ์‹คํ–‰? } // 1๋‹จ๊ณ„ : 10 > 20 || 1 != 1 || 3 > 2 // 2๋‹จ๊ณ„ : false || 1 != 1 || 3 > 2 // 3๋‹จ๊ณ„ : false || false || 3 > 2 // 4๋‹จ๊ณ„ : false || false || true // 5๋‹จ๊ณ„ : false || true // 4๋‹จ๊ณ„ ์•ž์— ์žˆ๋Š” false || false ์˜ ์—ฐ์‚ฐ๊ฒฐ๊ณผ๋กœ false ๊ฐ€ ๋œ๋‹ค. // 6๋‹จ๊ณ„ : true ๐Ÿ’ก&&(๊ทธ๋ฆฌ๊ณ , and) (์€..
public class Main { public static void main(String[] args) { // System.out ์—ฌ๊ธฐ์„œ . ์€ of ๋ฅผ ์˜๋ฏธ ํ•ฉ๋‹ˆ๋‹ค. // System.out.println(100); // ์—ฌ๊ธฐ์„œ println(100); ์™€ ๊ฐ™์€ ํ˜•ํƒœ๋Š” ํƒ€ ๋™์‚ฌ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. // System.out.println(100); // ์—ฌ๊ธฐ์„œ System.out ์€ ์ฃผ์–ด๋ฅผ ์˜๋ฏธ ํ•ฉ๋‹ˆ๋‹ค. // System.out.println(100); // ์—ฌ๊ธฐ์„œ 100์€ ๋ชฉ์ ์–ด ๋˜๋Š” ๋ณด์–ด ์ž…๋‹ˆ๋‹ค. // System.out.println(100); // ๊ฐœ๋ฐœ์ž๊ฐ€ "System.out" ๋ผ๋Š” ๋…€์„์—๊ฒŒ 100 ์„ println ํ•˜๋ผ๋Š” ์˜๋ฏธ // ํ”„๋กœ๊ทธ๋žจ์˜ ์‹œ์ž‘์  System.out.println(1); //..
daxx0ne
'STUDY ๐Ÿ“š/Java' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)