物件導向程式設計

 

 

      2.8 乘法和除法

 

 


授課教師:陳慶瀚

WWW : http://www.miat.ee.isu.edu.tw/java

E-mail : pierre@isu.edu.tw   

 


class MultiplyDivide 
{
  public static void main (String args[]) 
  {
    int i = 10;
    int j = 2;
    int k;

    System.out.println("i is " + i);
    System.out.println("j is " + j);
  
    k = i/j;
    System.out.println("i/j is " + k);
    k = i * j;
    System.out.println("i * j is " + k);
  }
}
 

Here's the result:

 

C:\> javac MultiplyDivide.java
C:\> java MultiplyDivide
i is 10
j is 2
i/j is 5
i * j is 20
C:\>

 

 


 

物件導向程式設計

義守大學電機系 陳慶瀚

2001.10.02