관리 메뉴

nalaolla

오브젝트 예제 1 본문

JAVA/6. Object2

오브젝트 예제 1

날아올라↗↗ 2016. 6. 22. 17:12
728x90
  1. package test.com;
  2.  
  3. public class Test01AAA {
  4.     private int x;
  5.     String y;
  6.     public int[] xs;
  7.     protected String[] ys;
  8. }






  1. package test.com;
  2.  
  3. public class Test01Main {
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         System.out.println("main...");
  8.        
  9. //    Test01AAA ta01 = new Test01AAA();
  10. //    System.out.println(ta01);
  11. //   
  12. //    ta01 = new Test01AAA();
  13. //    System.out.println(ta01);
  14. //   
  15. //    Test01AAA ta02 = new Test01AAA();
  16. //    System.out.println(ta02);
  17.        
  18.         //ex : int[] sus = new int[10];
  19.         Test01AAA[] tas = new Test01AAA[10];
  20.         for (int i = 0; i < 10; i++) {
  21.             Test01AAA ta01 = new Test01AAA();
  22.             System.out.println(ta01);
  23.             tas[i] = ta01;
  24.            
  25.         }
  26.        
  27.         System.out.println();
  28.        
  29.         for (int i = 0; i < tas.length; i++) {
  30.             System.out.println(tas[i]);
  31.         }
  32.        
  33.     } //end main
  34.  
  35. }   //end class


728x90

'JAVA > 6. Object2' 카테고리의 다른 글

오브젝트 예제 5  (0) 2016.06.22
오브젝트 예제 3 (class와 class 이용하여 배열처리)  (0) 2016.06.22
오브젝트 예제 2 (배열활용)  (0) 2016.06.22