본문 바로가기 메뉴 바로가기

Studying programming

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Studying programming

검색하기 폼
  • Jimin's Programming (194)
    • Algorithms (54)
    • JavaScript (16)
    • Vue.js (3)
    • Node.js (3)
    • React.js (7)
    • React Native (0)
    • Spring Boot (13)
    • JAVA (58)
    • C++ (17)
    • Programming (19)
    • Computer basics (4)
  • 방명록

Java constructor (1)
Difference between Setter and Constructor

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..

JAVA 2019. 8. 11. 03:58
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • hackerrank javascript solution
  • Javascript Algorithm
  • substring()
  • javascript
  • string class in java
  • 알고리즘
  • HackerRank Algorithm
  • math.abs
  • HashMap
  • Object type casting
  • hackerrank javascript
  • 프로그래머스 알고리즘
  • equals()
  • easy javascript algorithm
  • C++
  • repeat()
  • rest parameter
  • 프로그래머스
  • hackerrank
  • hackerrank solution
  • compareTo()
  • code refactoring
  • java
  • Collection Framework
  • spring boot application
  • algorithm
  • ... in Javascript
  • easy algorithm
  • 프로그래머스 알고리즘문제
  • math.max
more
«   2025/08   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바