프로그래밍 (1) 썸네일형 리스트형 자바 클래스(class) static 키워드를 가지는 메소드를 클래스 메소드(static method)라고 한다. static 키워드를 가지지 않는 메소드는 인스턴스 메소드(instance method)라고 한다. class Instance { int a = 10, b = 20; int add() { return a + b; } static int add(int x, int y) { return x + y; } } public class Hour_OF_Day { public static void main(String[] args) { System.out.println(Method.add(20, 30)); Method mymethod = new Method(); System.out.println(mymethod.add()); } .. 이전 1 다음