<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Java 程序:計算矩形面積 > 原文: [https://beginnersbook.com/2014/01/java-program-to-calculate-area-of-rectangle/](https://beginnersbook.com/2014/01/java-program-to-calculate-area-of-rectangle/) 在本教程中,我們將看到如何**計算矩形面積**。 **程序 1:** 用戶將在程序執行期間提供長度和寬度值,并根據提供的值計算面積。 ```java /** * @author: BeginnersBook.com * @description: Program to Calculate Area of rectangle */ import java.util.Scanner; class AreaOfRectangle { public static void main (String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter the length of Rectangle:"); double length = scanner.nextDouble(); System.out.println("Enter the width of Rectangle:"); double width = scanner.nextDouble(); //Area = length*width; double area = length*width; System.out.println("Area of Rectangle is:"+area); } } ``` 輸出: ```java Enter the length of Rectangle: 2 Enter the width of Rectangle: 8 Area of Rectangle is:16.0 ``` **程序 2:** 在上述程序中,將要求用戶提供長度和寬度值。如果您不需要用戶交互并且只想在程序中指定值,請參閱以下程序。 ```java /** * @author: BeginnersBook.com * @description: Calculation with no user interaction */ class AreaOfRectangle2 { public static void main (String[] args) { double length = 4.5; double width = 8.0; double area = length*width; System.out.println("Area of Rectangle is:"+area); } } ``` 輸出: ```java Area of Rectangle is:36.0 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看