Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- while
- DoM
- architecture
- Java
- DB
- Pipelining
- DS
- web
- python
- system
- Class
- DATAPATH
- control
- MacOS
- html
- XML
- Linux
- Algorithm
- github
- instruction
- function
- react
- mysql
- javascript
- for
- php
- CSS
- MIPS
- computer
- data structure
Archives
- Today
- Total
목록Accessor (1)
YYYEJI
[JAVA] Setter/Getter 메소드
Setter 란? Setter은 accessor method라고 불리며, instance variable을 읽어주는 public method입니다. getter 란? Getter은 mutator method라고 불리며, instance variable을 수정해주는 public method입니다. Setter/Getter는 왜 사용할까요? 객체의 변수(instance variable)를 객체 외부에서 직접적으로 접근하는 것을 막기 위해서 사용합니다. 객체의 외부에서는 method를 통해 변수에 접근하고 수정하도록 유도하고 있습니다. 예제를 살펴보기 위해 P class를 만들어줬습니다. public class p { private int width; private int height; public p() {..
Java
2022. 12. 26. 22:39