返回列表 發帖

物件導向基礎概念 (三)

  1. import java.lang.Math;   //引入類別庫 java.lang.* 中的 java.lang.Math 類別
  2. public class ch73    //主類別
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int x=2, y=5;
  7.         System.out.println(x+"的"+y+"次方為"+Math.pow(x,y));  //將變數代入Math類別中的pow()函式
  8.     }
  9. }
複製代碼

  1. import java.lang.Math;
  2. public class ch73
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int x=2, y=5;
  7.         System.out.println(x+"的"+y+"次方為"+Math.pow(x,y));
  8.     }
  9. }
複製代碼

TOP

  1. import java.lang.Math;
  2. public class ch73
  3. {
  4.      public static void main(String args[])
  5.      {
  6.           int x=2,y=5;
  7.           System.out.println(x+"的"+y+"次方為"+Math.pow(x,y));
  8.      }
  9. }
複製代碼

TOP

  1. import java.lang.Math;
  2. public class ch73
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int x=2, y=5;
  7.         System.out.println(x+"的"+y+"次方為"+Math.pow(x,y));
  8.     }
  9. }
複製代碼

TOP

  1. import java.lang.Math;
  2. public class ch73
  3. {
  4.   public static void main(String args[])
  5.   {
  6.     int x=2,y=5;
  7.     System.out.println(x+"的"+y+"次方為"+Math.pow(x,y));
  8.   }
  9. }
複製代碼

TOP

  1. import java.lang.Math;
  2. public class ch73
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int x=2, y=5;
  7.         System.out.println(x+"的"+y+"次方為"+Math.pow(x,y));
  8.     }
  9. }
複製代碼

TOP

返回列表