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..
Read CSV File and store the data to MySQL in database table. CSV File에서 가지고 온 데이터를 MySQL DB에 저장하기 Use preparedStatement object to insert data to MySQL. You can use Statement object to insert Statement statement = conn.createStatement(); PreparedStatement is more secure so, it's preferred. PreparedStatement st = conn.prepareStatement(query); *SELECT query createStatement() setString(int, String) ..
When ArrayList is needed from another class, use get/set method to return the list 다른 class에 있는 ArrayList를 사용하고 싶을 때는 get/set 메서드를 이용해서 불러오면 된다. Example code I class 1 import java.util.ArrayList; import java.util.Iterator; public class Main { public static void main(String[] args) { AnotherClass anotherClass = new AnotherClass(); anotherClass.addList(); ArrayList list = anotherClass.getList(); I..
Error The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specific time zone value if you want to utilize time zone support. Start MySQL mysql -u root -p Change directory to search my.cnf cd /usr/local/etc/my.cnf Check "my.cnf" File cat my.cnf add ..
Mac OS Java 8.0 MySQL 5.7.27 connector 8.0.17 Install MySQL Option 1. Visit MySQL website to download https://dev.mysql.com/downloads/connector/j Option 2. Use Homebrew which is a free and open-source software package management system that simplifies the installation of software on Apple's macOS. Decompress the file. We will use file mysql-connector-java-8.0.17.jar Connecting to JDBC IntelliJ -..
- Total
- Today
- Yesterday
- hackerrank javascript
- javascript
- java
- spring boot application
- code refactoring
- math.abs
- hackerrank solution
- C++
- 프로그래머스 알고리즘
- algorithm
- compareTo()
- hackerrank javascript solution
- easy algorithm
- ... in Javascript
- repeat()
- Collection Framework
- equals()
- HashMap
- substring()
- easy javascript algorithm
- 프로그래머스 알고리즘문제
- 프로그래머스
- string class in java
- HackerRank Algorithm
- math.max
- hackerrank
- 알고리즘
- Object type casting
- rest parameter
- Javascript Algorithm
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |