728x90 자바 스태틱 메소드1 [JAVA] ch05-14. Static method (스태틱 메서드) 2 public class Ex14 { int iv = 10; // iv(instance variable) static int cv = 20; //cv(class variable) int iv2 = cv; //static int cv2 = iv; //(X) static int cv2 = new Ex14().iv; //(O) static void sm1(){ // sm(static method) System.out.println(cv); //System.out.println(iv);//(X) System.out.println(new Ex14().iv);//(O) } void im1(){ //im(instance method) System.out.println(cv); System.out.println(iv);.. JAVA/예제 2017. 8. 22. 이전 1 다음 728x90