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
- 반복문
- length
- illustrator
- Photoshop
- do while문
- Overload
- 변수
- super
- expand
- while문
- 파라미터
- Interface
- private
- switch문
- 상속
- 생성자
- static
- 멤버변수
- 클래스
- Java
- for문
- Override
- 메서드
- Singleton
- 배열
- 형변환
- if문
- symbol
- After effects
- 조건문
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