반응형
자바 클래스 메소드를 외부에 선언하고 콜하독 구성할 수 있습니다.
1. 외부 클래스 및 메소드 정의
public class myMethod_public {
static String myMethod() {
return "hello world 4";
}
}
2. 외부 클래스 메소드 콜 및 결과 확인 클래스 추가
public class remote_call {
public static void main(String[] args) {
System.out.println("hello world 3");
String text = myMethod_public.myMethod();
System.out.print(text);
}
}
예상 결과
hello world 3
hello world 4
728x90
'웹서버 프로그래밍 (node.js) > 자바 프로그래밍' 카테고리의 다른 글
자바 시간 delay (0) | 2020.03.02 |
---|---|
자바 Class 내부 Method 선언 및 내부 Method Call (0) | 2020.03.02 |
자바 hello world (0) | 2020.03.02 |
자바 , 이클립스 설치 (0) | 2020.02.28 |