νμ΅ λ΄μ© - Collection : μμ§ List: λͺ©λ‘ ArrayList λ°°μ΄μ²λΌ μ¬μ©ν μ μλ 리μ€νΈ μ νꡬ쑰 O-O-O-O-O κ²μμλκ° λΉ λ₯΄λ€ indexλ‘ μ κ·Όνλ€ LinkedList μΆκ°/μμ μλκ° λΉ λ₯΄λ€ ArrayList arrlist = new ArrayList(); // κΈ°λ³Ένμ //μΆκ° --> .add(μ μ₯κ°) λ₯Ό ν΅ν΄ μ°¨λ‘λλ‘ κ° μ μ₯ arrlist.add(111); Integer in = new Integer(222); arrlist.add(in); arrlist.add(new Integer(333)); int len = arrlist.size(); System.out.println("λͺ©λ‘μ ν¬κΈ° " + len);// κ²°κ³Ό : λͺ©λ‘μ ν¬κΈ° 3 for (int i = 0; i < ..
μ 체 κΈ
λ λμ κ°λ°μκ° λκΈ° μν λμ κΈ°λ‘ π![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbiex7V%2FbtqVcs9KhuH%2FeDOAxfW5nAneg0GyCoPsSk%2Fimg.jpg)
- Class Diagram κ°λ¨νκ² ν΄λμ€ λ€μ΄μ΄κ·Έλ¨μ μμ±ν΄λ³΄μλ€. μμμ λν νμ΄νλ μ νν μκ² λλ° λ€λ₯Έ νλ¦μ μ΄λ»κ² νμ΄νλ‘ νννλμ§λ λ 곡λΆν΄λ΄μΌκ² λ€. (μμ +μ -λ public μΈμ§ private μΈμ§ ꡬλ³) - MainClass switchλ¬Έμ μ΄μ©ν΄ λ©λ΄λ₯Ό λ§λ€μ΄λμλ€. package main; import java.io.IOException; import java.util.Scanner; import dao.DaoClass; import dto.HumanDto; public class MainClass { public static void main(String[] args) throws IOException { //HumanDto playerArr[] = new HumanDt..
νμ΅ λ΄μ© - μμ - instanceof λΆλͺ¨ν΄λμ€μ μΈμ€ν΄μ€λ‘ μμ±λ μμ ν΄λμ€μ μΈμ€ν΄μ€λ₯Ό μ°Ύμμ£Όλ μμ½μ΄ for (int i = 0; i < scArr.length; i++) { if(scArr[i] instanceof ChildOne) {// λΆλ¦°κ°μΌλ‘ λνλΈλ€. System.out.println("true"); } } (cast λ³νμ ν·κ°λ¦¬λ λΆλΆμ΄λ κ³μν΄μ λ΄μ κΌ μ΄ν΄ν κ².) public class MainClass { public static void main(String[] args) { ChildClass cc = new ChildClass(); cc.method(); ParentClass pc = new ChildClass();//Parent μ£Όμκ°μ κ°μ§ ChildClass..
νμ΅ λ΄μ© - μ μ°¨μ§ν₯ : λ³μμ μΈ, ν¨μ -> μ°μ° (μμμ§ν₯) -> ex) line 50000 ex ) μ£Όμ¬μ (νλλ§λ€μ΄λμΌλ©΄ κ³μ μ¬μ©) -> νμ₯μ± μ μ§λ³΄μ μ©μ΄, μ¬μ¬μ©μ± μ’λ€. μ½λ μμ±μ μμ΄ μ€μν *κ°λ
μ±*μ΄ ν₯μλλ€. - μμ±μ (constructor) : ν¨μ(λ©μλ) ν΄λμ€λͺ
κ³Ό κ°λ€ returnκ°μ΄ μλ€ Over Loadκ° κ°λ₯νλ€ class μμ± μ μλ νΈμΆ λ³λμ νΈμΆ λΆκ° != μ΄κΈ°ν μλ΅ κ°λ₯ - μλ©Έμ (destructor) (μλ°μμ μμ°μ΄μ§λ§ μ΄λ°κ² μλ€λ κ²λ§ μμλμ.) λ°λμ 1κ° public class TestClass { int number; public TestClass() {//..
νμ΅ λ΄μ© - Exception : μμΈ != error public class Mainclass { public static void main(String[] args) { int c; try { c = 4 / 0;//tryλ¬Έμμ μμΈκ° λ°μνλ©΄ }catch(ArithmeticException e) { c = -1; //catchλ¬Έμ΄ μνλλ€. } System.out.println(c); } }//κ²°κ³Ό κ° : -1 - 2μ§ ν¨μ μ§μ λ§λ€κΈ° μμ binary λ©μλλ λ΄κ° λ§λ€μκ³ , μλ change λ©μλλ κ°μ¬λμ΄ λ§λ€μ΄μ£Όμ
¨λ€. λ΄κ° λ§λ κ²λ μ μ μλμ λμμ§λ§, μλ λ©μλμ λΉκ΅ν΄λ³΄λ λ κ°λ¨νκ² λνλΌ μ μλ λ°©λ²μ μκ² λμλ€. package work02; public class Mai..
νμ΅ λ΄μ© - Calendar μΌμ κ΄λ¦¬, νμ κ΄λ¦¬, μΈμ¬ κ΄λ¦¬ λ±λ± - Calendar cal = Calendar.getInstance(); λ₯Ό μ΄μ©ν΄ λΆλ¬μ€κΈ° //getter int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH) + 1; // μμ 0 ~ 11λ‘ νννκΈ° λλ¬Έμ +1λ₯Ό ν΄μ€μΌ μ μμ μΌλ‘ μΆλ ₯ int day = cal.get(Calendar.DATE); int hour = cal.get(Calendar.HOUR); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); //λ μ§ μ€μ (setter) cal.set(Calendar...
νμ΅ λ΄μ© - Sorting : μ λ ¬ μ€λ¦μ°¨μ : 1, 2, 3.... λ΄λ¦Όμ°¨μ : 9, 8, 7.... - μ νμ λ ¬ int[] number = { 5, 9, 1, 8, 2, 6, 4, 7, 3, 10 }; int temp; for (int i = 0; i number[j]) { //iλ²μ§μ μ«μ jλ²μ§μ μ«μλ³΄λ€ ν΄ κ²½μ° κ΅ν (μ€λ¦μ°¨μ) //swap//λΆλ±νΈ κΈ°νΈλ§ λ°κΎΈλ©΄ λ΄λ¦Όμ°¨μ temp = number[i]; number[i] = number[j]; number[j] = temp; } } } S..
νμ΅ λ΄μ© - while, do whileλ¬Έ public class mainClass { public static void main(String[] args) { //whileλ¬Έ ------------------------------------------------------------ int w; w = 0;//μ΄κΈ°ν while(w