웹서버 프로그래밍 (node.js)/자바 프로그래밍 5

자바 Class 외부 Method 선언 및 외부 Method Call

자바 클래스 메소드를 외부에 선언하고 콜하독 구성할 수 있습니다. 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

자바 Class 내부 Method 선언 및 내부 Method Call

자바에서는 Class 내에 Method를 선언하고 외부에서 Method를 Call할 수 있습니다. 프로그램 public class method_call { static String myMethod() { return "hello world 2"; } public static void main(String[] args) { System.out.println("hello world 1"); String text = myMethod(); System.out.print(text); } } 예상결과 hello world 1 hello world 2 풀이 1. 메소드를 call하면 문자 String을 되돌려주는 메소드 정의 static String myMethod() { return "hello world 2"; ..

자바 hello world

자바와 이클립스 설치 후 간단한 test하는 프로그램입니다. public class hello_world { public static void main(String[] args) { System.out.println("hello world 1"); } } 예상 결과 hello world 1 해석 public class hello_world -> hello_world 라는 클래스를 만들어라 public static void main(String[] args) -> 이 부분을 자동으로 실행해라 System.out.println("hello world 1"); -> 컨솔에 hello world 1 을 표시해라

자바 , 이클립스 설치

1. JAVA(TM) SE Development Kit 다운로드 https://www.oracle.com/technetwork/java/javase/downloads/index.html jdk-13.0.2_windows-x64_bin.exe (64비트 기준) 을 다운로드함 2. JDK 설치 3. 시스템 환경변수 편집 화면 열기 4. 시스템 변수 새로만들기 -변수명: JAVA_HOME -변수값: C:\Program Files\Java\jdk-13.0.2 5. 시스템 변수 편집 -변수명: path -변수값: ;%JAVA_HOME%\bin; 를 추가 6. 이클립스 설치파일 다운로드 아래 사이트 접속 https://www.eclipse.org/downloads/ Eclipse Downloads | The Ecl..