Setter 메서드와 Constructor 생성자의 차이 1. 생성자는 객체를 초기화하기 수월하게 해주는 역할이고 Setter는 메서드이기에 객체가 할 수 있는 행위를 표현하는데 목적이 있다. 2. 생성자는 return type이 없고 setter 는 메서드기에 return type을 반드시 가지고 있다. 3. 생성자는 객체가 생성될 때 자동으로 실행되지만 메서드는 임의로 call을 해서 사용한다. 4. Setter는 값을 update하는 용도로 사용된다 즉, 값이 수정될 가능성이 있다면 setter 가 있어야하고 수정될 일이 없다면 final 로 변수를 선언하고 constructor만으로도 충분하다. Reference https://stackoverflow.com/questions/19359548/se..
Builder Pattern Builder pattern is how you create a complex object especially when you have many arguments. It gives apparent division between the construction and representation of an object Example Code public class BuilderPattern { private long id; private String name; private String email; private String phone; private String address; //Inner static class public static class Builder{ //Essen..
[] for Array {} for Object document.write - It's a DOM method that allows writing HTML expressions and JavaScript code to a document. - DOM에서 html처럼 text를 쓸 수 있는 method. Example code var food = { "fruit" : "orange", //객체의 property는 key 와 value로 이루어져있다 "veggie":"onion", }; //print the object document.write("fruit : " + food.fruit + ""); document.write("veggie : " + food.veggie + ""); //add more i..
JavaScript에서 String + Number 는 String의 결과값을 내놓는다. 그걸 방지하기 위해서 괄호를 이용한다. Example Code function sumTextColor(left, right){ document.write(left+right); //6 document.write(''+left+right+''); //15 document.write(''+(left+right)+' '); //6 } sumTextColor(1,5); output 6 15 6
Insertion Sort 삽입정렬 Insert an element in the sorted subarray to its left. 두번째 Index를 시작으로 자신보다 앞 쪽 (왼쪽) 의 값과 계속 비교해가면서 자리를 옮겨나가는 알고리즘이다. How the Insertion array works int arr[] = [3,5,1,4,2] partial sorted subarray partial unsorted array [3] [5,1,4,2] [3,5] [1,4,2] [3,5,1] -> [3,1,5] -> [1,3,5] [4,2] [1,3,5,4] -> [1,3,4,5] [2] [1,3,4,5,2] -> [1,3,4,2,5] -> [1,3,2,4,5] -> [1,2,3,4,5] [] Solution ..
- Total
- Today
- Yesterday
- Object type casting
- hackerrank javascript solution
- rest parameter
- math.abs
- algorithm
- repeat()
- math.max
- code refactoring
- Collection Framework
- easy algorithm
- 프로그래머스 알고리즘
- 프로그래머스
- equals()
- C++
- ... in Javascript
- spring boot application
- compareTo()
- javascript
- easy javascript algorithm
- substring()
- hackerrank
- 알고리즘
- string class in java
- Javascript Algorithm
- HackerRank Algorithm
- hackerrank javascript
- hackerrank solution
- 프로그래머스 알고리즘문제
- java
- HashMap
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |