6. แยกย่อย

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 6-4  ตัวอย่างเมท็อดที่เขียนผิด
  public static print(String t) {  
    System.out.println( t );
  }
  public static int abs(int a) {
    if ( a < 0 ) return -a;
  }
  public static double max(double x, y) {
    if ( x > y ) return x; else return y;
  }
  public static double length(double dx, double dy) {
    double dx = Math.abs(dx);
    return Math.sqrt( dx*dx + dy*dy );
  }
  public static int b(int b) {
    while (true)
      System.out.println("hello");
    return 0;
  }
©2009 S.Prasitjutrakul