edit fork download

  1. import java.util.*;
  2. class mymath
  3. { long a; long b;
  4.  
  5. long add(){System.out.println("instance");return a+b;}
  6. long sub(){System.out.println("instance");return a-b;}
  7. long mul(){System.out.println("instance");return a*b;}
  8. long div(){System.out.println("instance");return a/b;}
  9.  
  10.  
  11. static long add(long a, long b){return a+b;}
  12. static long sub(long a, long b){return a-b;}
  13. static long mul(long a, long b){return a*b;}
  14. static long div(long a, long b){return a/b;}
  15. }
  16.  
  17.  
  18. public class static_method {
  19. public static void main(String[] args)
  20. {
  21. System.out.println(mymath.add(20L, 30L));
  22. }
  23.  


이렇게 대충짜봤는데<늒비>


static 매소드는 결국 클래스의 메소드고 인스턴트<햄버거같은거아님> 메소드는 그냥 외부 메소드라


메인에서 접근할때 스태틱메소드는 클래스 . 메소드이름();

이렇게 할수있고


인스탄트 메소드는 객체 생성후 객체에서 호출이 가능한건가여?

헷갈려양! 쉽게 풀어줄사람없어양?


갑자기 인스턴트 하니까 새로나온 맥도날드 햄버거 먹고싶은거에여.. 파오후