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
- 멤버변수
- 메서드
- private
- 상속
- switch문
- Interface
- while문
- 클래스
- Java
- Photoshop
- static
- length
- 반복문
- symbol
- 변수
- do while문
- Overload
- 파라미터
- 조건문
- expand
- super
- 배열
- Override
- 형변환
- for문
- 생성자
- Singleton
- illustrator
- After effects
- if문
Archives
- Today
- Total
Ms'Note
Method-3 본문
리턴값의 사용
public class Main03 {
public static void main(String[] args) {
// 메서드의 리턴값을 변수에 저장한다.
int a = f1(100);
System.out.println(a);
// 리턴값을 출력에 사용한다.
System.out.println(f2(10));
}
public static int f1(int x) {
int y = x + 1;
return y;
}
public static int f2(int x) {
return x * x + 1;
}
}
출력 결과
101
101
Comments