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
- 참고블로그
- JS #프로젝트
- setTimeout()
- ajax
- promise
- async
- Project
- addEventListener
- 혼프
- https://m.blog.naver.com/tt2t2am1118/221010125300
- callback
- object
- database
- js
- webpack
- mysql
- Import
- json
- sql
- Porject
- db
- await
- execCommand
- prj
- slow and steady
- https://youtube.com/playlist?list=PLuHgQVnccGMA5836CvWfieEQy0T0ov6Jh&si=FTaYv8m21EhO-A2K
- eport
- 게임
- 동기
- 비동기
Archives
- Today
- Total
C-log
커피 한 잔의 JAVA : 캡슐화 그리고 setter와 getter_part.2 본문
728x90
package Section8_12;
public class MotorBike {
private int speed;
public int sPeed;
void setSpeed(int speed) {
if (speed > 0)
this.speed = speed;
// System.out.println(speed);
// System.out.println(this.speed);
}
int getSpeed() {
return this.speed;
}
public int increaseSpeed(int howMuch) {
setSpeed(this.speed + howMuch);
return this.speed;
}
public int decreaseSpeed(int howMuch) {
setSpeed(this.speed - howMuch);
return this.speed;
}
public void start() {
System.out.println("Bike Started!!");
}
}
728x90
'📕JAVA > in28Minues' 카테고리의 다른 글
커피 한 잔의 JAVA : 생성자 (0) | 2023.05.17 |
---|---|
커피 한 잔의 JAVA : 캡슐화 그리고 setter와 getter_part.1 (0) | 2023.05.17 |
Comments