프로그래밍/Java
#5 Java Return이 있는 메서드 선언 및 호출
New! Game
2019. 11. 24. 11:49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package ex;
// 하나의 패키지 하나의 클래스 return 있고 입력 없는 메서드 선언 및 호출
public class AA01 {
public static void main(String[] args) {
// 메서드 호출
int result = a();
//호출된 메서드의 값
System.out.println(result + " <- result");
}
// return data type int 메서드 선언
public static int a() {
System.out.println("01 a 메서드 실행");
return 10;
}
}
|
cs |
void : return data type 없음