관리 메뉴

nalaolla

Method 예제 3 (활용예제) 본문

JAVA/8. Method1

Method 예제 3 (활용예제)

날아올라↗↗ 2016. 6. 22. 17:23
728x90
  1. package test.com;
  2.  
  3. public class Test02Method {
  4.    
  5.     public void test1() {
  6.         System.out.println("test");
  7.     }
  8.    
  9.     public void test2(int a) {
  10.         System.out.println(a);
  11.     }
  12.    
  13.     public int test3() {
  14.         System.out.println("test");
  15.         int resultInt = 44;
  16.         return resultInt;
  17.     }
  18.    
  19.     public String test4(int[] sus) {
  20.         System.out.println(sus.length);
  21.         return "KIM";
  22.     }
  23.    
  24.     public static void main(String[] args) {
  25.         System.out.println("method2...");
  26.        
  27.         Test02Method tm02 = new Test02Method();
  28.  
  29.         tm02.test1();
  30.        
  31.         tm02.test2(456);
  32.        
  33.         int x = tm02.test3();
  34.         System.out.println(x);
  35.        
  36.         int[] sus = new int[]{1,2,3,4,5};
  37.         String firstName = tm02.test4(sus);
  38.         System.out.println(firstName);
  39.     }
  40. }


728x90

'JAVA > 8. Method1' 카테고리의 다른 글

Method 예제 5  (0) 2016.06.22
Method 예제 4  (0) 2016.06.22
Method 예제 2 (Method 정리)  (0) 2016.06.22
Method 예제 1 (예외처리)  (0) 2016.06.22