[JAVA์ ์ ์] Chapter11_์ฐ์ต๋ฌธ์
[11-1] ๋ค์์ ์ ์์งํฉ 1, 2, 3, 4์ 3, 4, 5, 6์ ๊ต์งํฉ, ์ฐจ์งํฉ, ํฉ์งํฉ์ ๊ตฌํ๋ ์ฝ๋์ด๋ค. ์ฝ๋๋ฅผ ์์ฑํ์ฌ ์คํ๊ฒฐ๊ณผ์ ๊ฐ์ ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅํ์์ค. [Hint] ArrayListํด๋์ค์ addAll( ), removeAll( ), retainALL( )์ ์ฌ์ฉํ๋ผ. list1=[1, 2, 3, 4]list2=[3, 4, 5, 6]kyo=[3, 4]cha=[1, 2]hap=[1, 2, 3, 4, 5, 6] ๋ตimport java.util.*;class Exercise11_1 { public static void main(String[] args) { ArrayList list1 = new ArrayList(); ArrayList list2 = new ArrayList(); Arra..
2024. 12. 15.
[JAVA์ ์ ์] Chapter05_์ฐ์ต๋ฌธ์
[5-1] ๋ค์์ ๋ฐฐ์ด์ ์ ์ธํ๊ฑฐ๋ ์ด๊ธฐํํ ๊ฒ์ด๋ค. ์๋ชป๋ ๊ฒ์ ๊ณ ๋ฅด๊ณ ๊ทธ ์ด์ ๋ฅผ ์ค๋ช
ํ์์ค.1.int[] arr[];2.int[] arr = {1,2,3,};3.int[] arr = new int[5];4.int[] arr = new int[5]{1,2,3,4,5};5.int arr[5];6.int arr[] = new int[3][]; ๋ต : 4,5[5-2] ๋ค์๊ณผ ๊ฐ์ ๋ฐฐ์ด์ด ์์ ๋, arr[3].length์ ๊ฐ์ ์ผ๋ง์ธ๊ฐ?int[][] arr = { {5,5,5,5,5}, {10,10,10}, {20,20,20,20} {30,30}}; ๋ต : 2[5-3] ๋ฐฐ์ด arr์ ๋ด๊ธด ๋ชจ๋ ๊ฐ์ ๋ํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ๋ต : public class Exercise5_..
2024. 12. 8.