久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='z48hF'></tfoot>

        <bdo id='z48hF'></bdo><ul id='z48hF'></ul>
      <legend id='z48hF'><style id='z48hF'><dir id='z48hF'><q id='z48hF'></q></dir></style></legend>
    1. <small id='z48hF'></small><noframes id='z48hF'>

        <i id='z48hF'><tr id='z48hF'><dt id='z48hF'><q id='z48hF'><span id='z48hF'><b id='z48hF'><form id='z48hF'><ins id='z48hF'></ins><ul id='z48hF'></ul><sub id='z48hF'></sub></form><legend id='z48hF'></legend><bdo id='z48hF'><pre id='z48hF'><center id='z48hF'></center></pre></bdo></b><th id='z48hF'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='z48hF'><tfoot id='z48hF'></tfoot><dl id='z48hF'><fieldset id='z48hF'></fieldset></dl></div>

      1. MissingFormatArgumentException 錯誤

        MissingFormatArgumentException error(MissingFormatArgumentException 錯誤)

      2. <small id='yLpxa'></small><noframes id='yLpxa'>

        <i id='yLpxa'><tr id='yLpxa'><dt id='yLpxa'><q id='yLpxa'><span id='yLpxa'><b id='yLpxa'><form id='yLpxa'><ins id='yLpxa'></ins><ul id='yLpxa'></ul><sub id='yLpxa'></sub></form><legend id='yLpxa'></legend><bdo id='yLpxa'><pre id='yLpxa'><center id='yLpxa'></center></pre></bdo></b><th id='yLpxa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yLpxa'><tfoot id='yLpxa'></tfoot><dl id='yLpxa'><fieldset id='yLpxa'></fieldset></dl></div>
        • <bdo id='yLpxa'></bdo><ul id='yLpxa'></ul>
        • <tfoot id='yLpxa'></tfoot>
            <tbody id='yLpxa'></tbody>

            1. <legend id='yLpxa'><style id='yLpxa'><dir id='yLpxa'><q id='yLpxa'></q></dir></style></legend>

                  本文介紹了MissingFormatArgumentException 錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已經成功編譯了我的庫存程序:

                  //Inventory.java 第 1 部分//這個程序是計算電子部相機庫存的價值導入 java.util.*;導入 javax.swing.*;導入 java.awt.event.*;導入java.io.*;公共類庫存{公共靜態無效主要(字符串 [] 參數){//創建掃描器以從命令窗口獲取輸入掃描儀輸入 = 新掃描儀(System.in);字符串名稱;int 項目編號;//第一個要相乘的數字int itemStock;//第二個要相乘的數字雙項價格;//雙倍總價值;//number1 和 number2 的乘積while(true){//無限循環//創建新的相機對象System.out.print("請輸入部門名稱:");//迅速的String itemDept = input.nextLine();//讀取用戶名if(itemDept.equals("stop"))//退出循環休息;{System.out.print("請輸入項目名稱:");//迅速的名稱 = input.nextLine();//讀取用戶的第一個數字input.nextLine();}System.out.print("請輸入商品編號:");//迅速的itemNumber = input.nextInt();//讀取用戶的第一個數字input.nextLine();而(項目編號 <= -1){System.out.print("請輸入有效數字:");//迅速的itemNumber = input.nextInt();//從用戶 input.nextLine() 中讀取第一個數字;}/* while 語句,條件是輸入負數提示用戶輸入正數 */System.out.print("輸入手頭的物品數量:");//迅速的itemStock = input.nextInt();//讀取用戶的第一個數字input.nextLine();而(項目庫存 <= -1){System.out.print("輸入正數的手頭物品數:");//迅速的itemStock = input.nextInt();//讀取用戶的第一個數字input.nextLine();}/* while 語句,條件是輸入負數提示用戶輸入正數 */System.out.print("輸入商品價格:");//迅速的itemPrice = input.nextDouble();//從用戶那里讀取第二個數字input.nextLine();而(項目價格 <= -1){System.out.print("請輸入商品價格的正數:");//迅速的itemPrice = input.nextDouble();//讀取用戶的第一個數字input.nextLine();}/* while 語句,條件是輸入負數提示用戶輸入正數 */Cam camera = new Cam(name, itemNumber, itemStock, itemPrice);totalValue = itemStock * itemPrice;//乘數System.out.println("部門名稱:" + itemDept);//顯示部門名稱System.out.println("物品編號:" + camera.getItemNumber());//顯示商品編號System.out.println("產品名稱:" + camera.getName());//顯示項目System.out.println("數量:" + camera.getItemStock());System.out.println("單價" + camera.getItemPrice());System.out.printf("總值為:$%.2f
                  " + totalValue);//顯示產品}//結束 while 方法}//結束方法 main}/* 結束類庫存 */類凸輪{私有字符串名稱;私人 int itemNumber;私有 int itemStock;私人雙項價格;私人字符串部門名稱;公共凸輪(字符串名稱,int itemNumber,int itemStock,double itemPrice){this.name = 名稱;this.itemNumber = itemNumber;this.itemStock = itemStock;this.itemPrice = itemPrice;}公共字符串 getName(){返回名稱;}公共 int getItemNumber(){返回項目編號;}公共 int getItemStock(){返回項目庫存;}公共雙 getItemPrice(){返回項目價格;}}

                  <塊引用>

                  C:Java>java 庫存
                  輸入部門名稱:電子
                  輸入項目名稱:相機
                  輸入貨號:12345
                  輸入手頭的物品數量:8
                  輸入商品價格:100.50
                  部門名稱:電子學
                  貨號:12345
                  產品名稱:相機
                  數量:8
                  單價100.5
                  總值是:
                  線程主"java.util.MissingFormatArgumentException 中的 $Exception:
                  格式說明符.2f"
                  在 java.util.Formatter.format(未知來源)
                  在 java.io.PrintStream.format(未知來源)
                  在 java.io.PrintStream.printf(未知來源)
                  在 Inventory.main(Inventory.java:82)

                  我似乎遇到了這種格式錯誤,不明白為什么.

                  解決方案

                  如果你使用printf,你需要將占位符指定為printf參數以及格式細繩.在您的情況下,您通過附加金額來傳遞單個字符串,因此會出現錯誤.

                  System.out.printf("總值為:$%.2f
                  " + totalValue)

                  應該替換為

                  System.out.printf("總值為:$%.2f
                  ", totalValue)

                  I have been successful in compiling my inventory program:

                  // Inventory.java part 1
                  // this program is to calculate the value of the inventory of the Electronics Department's cameras
                  
                  import java.util.*;
                  import javax.swing.*;
                  import java.awt.event.*;
                  import java.io.*;
                  
                  public class Inventory
                  {
                     public static void main(String[] args)
                     {
                         // create Scanner to obtain input from the command window
                         Scanner input = new Scanner (System.in);
                  
                         String name;
                         int itemNumber; // first number to multiply
                         int itemStock; // second number to multiply
                         double itemPrice; //
                         double totalValue; // product of number1 and number2
                  
                  
                  
                     while(true){       // infinite loop
                                // make new Camera object
                  
                        System.out.print("Enter Department name: "); //prompt
                        String itemDept = input.nextLine(); // read name from user
                  
                              if(itemDept.equals("stop"))  // exit the loop
                             break;
                  
                  
                   {
                   System.out.print("Enter item name: "); // prompt
                   name = input.nextLine(); // read first number from user
                   input.nextLine();
                  
                  
                       }
                  
                   System.out.print("Enter the item number: "); // prompt
                   itemNumber = input.nextInt(); // read first number from user
                   input.nextLine();
                    while( itemNumber <= -1){
                   System.out.print("Enter valid number:"); // prompt
                   itemNumber = input.nextInt(); // read first number from user input.nextLine();
                   } /* while statement with the condition that negative numbers are entered
                   user is prompted to enter a positive number */
                  
                   System.out.print("Enter number of items on hand: "); // prompt
                   itemStock = input.nextInt(); // read first number from user
                   input.nextLine();
                    while( itemStock <= -1){
                   System.out.print("Enter positive number of items on hand:"); // prompt
                   itemStock = input.nextInt(); // read first number from user
                   input.nextLine();
                   } /* while statement with the condition that negative numbers are entered
                   user is prompted to enter a positive number */
                  
                   System.out.print("Enter item Price: "); // prompt
                   itemPrice = input.nextDouble(); // read second number from user
                   input.nextLine();
                    while( itemPrice <= -1){
                   System.out.print("Enter positive number for item price:"); // prompt
                   itemPrice = input.nextDouble(); // read first number from user
                   input.nextLine();
                   } /* while statement with the condition that negative numbers are entered
                   user is prompted to enter a positive number */
                  
                  
                   Cam camera = new Cam(name, itemNumber, itemStock, itemPrice);
                  
                   totalValue = itemStock * itemPrice; // multiply numbers
                  
                   System.out.println("Department name:" + itemDept); // display Department name
                   System.out.println("Item number: " + camera.getItemNumber()); //display Item number
                   System.out.println("Product name:" + camera.getName()); // display the item
                   System.out.println("Quantity: " + camera.getItemStock());
                   System.out.println("Price per unit" + camera.getItemPrice());
                   System.out.printf("Total value is: $%.2f
                  " + totalValue); // display product
                  
                         } // end while method
                  
                     } // end method main
                  
                  }/* end class Inventory */
                  
                  class Cam{
                  
                  private String name;
                  private int itemNumber;
                  private int itemStock;
                  private double itemPrice;
                  private String deptName;
                  
                  public Cam(String name, int itemNumber, int itemStock, double itemPrice) {
                  this.name = name;
                  this.itemNumber = itemNumber;
                  this.itemStock = itemStock;
                  this.itemPrice = itemPrice;
                     }
                  
                     public String getName(){
                        return name;
                        }
                  
                  
                  
                     public int getItemNumber(){
                     return itemNumber;
                  
                  }
                  
                     public int getItemStock(){
                     return itemStock;
                  
                  }
                  
                     public double getItemPrice(){
                      return itemPrice;
                  
                  }
                  
                  }
                  

                  C:Java>java Inventory
                  Enter Department name: Electronics
                  Enter item name: camera
                  Enter the item number: 12345
                  Enter number of items on hand: 8
                  Enter item Price: 100.50
                  Department name:Electronics
                  Item number: 12345
                  Product name:camera
                  Quantity: 8
                  Price per unit100.5
                  Total value is:
                  $Exception in thread "main" java.util.MissingFormatArgumentException:
                  Format specifier '.2f'
                  at java.util.Formatter.format(Unknown Source)
                  at java.io.PrintStream.format(Unknown Source)
                  at java.io.PrintStream.printf(Unknown Source)
                  at Inventory.main(Inventory.java:82)

                  I seem to come to this format error and cannot see why.

                  解決方案

                  If you are using printf, you need to specify the placeholders as printf parameters along with the format string. In your case you are passing a single string by appending the amount hence the error.

                  System.out.printf("Total value is: $%.2f
                  " + totalValue)
                  

                  should be replaced by

                  System.out.printf("Total value is: $%.2f
                  ", totalValue)
                  

                  這篇關于MissingFormatArgumentException 錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

                  <legend id='89Le7'><style id='89Le7'><dir id='89Le7'><q id='89Le7'></q></dir></style></legend>

                      <bdo id='89Le7'></bdo><ul id='89Le7'></ul>
                      <i id='89Le7'><tr id='89Le7'><dt id='89Le7'><q id='89Le7'><span id='89Le7'><b id='89Le7'><form id='89Le7'><ins id='89Le7'></ins><ul id='89Le7'></ul><sub id='89Le7'></sub></form><legend id='89Le7'></legend><bdo id='89Le7'><pre id='89Le7'><center id='89Le7'></center></pre></bdo></b><th id='89Le7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='89Le7'><tfoot id='89Le7'></tfoot><dl id='89Le7'><fieldset id='89Le7'></fieldset></dl></div>
                        <tbody id='89Le7'></tbody>
                      <tfoot id='89Le7'></tfoot>

                          • <small id='89Le7'></small><noframes id='89Le7'>

                            主站蜘蛛池模板: 免费性视频 | 欧美又大粗又爽又黄大片视频 | 亚洲性综合网 | 日本成人一区二区 | 9999在线视频 | 国产在线资源 | 日韩免费视频一区二区 | 亚洲视频三 | 国产999精品久久久影片官网 | 午夜在线免费观看视频 | 成年免费大片黄在线观看一级 | 亚洲欧美日韩成人在线 | 久久精品在线 | 99re视频精品 | 亚洲视频在线观看免费 | 国产日韩91 | 国产精品久久亚洲7777 | 一级黄色毛片免费 | 亚洲欧美精品在线观看 | av入口| www.国产.com| 毛片一区二区三区 | 国产精品视频网 | 中国一级特黄毛片大片 | 福利久久 | 成人av免费| 久久久久久艹 | 午夜久久久 | 天天操人人干 | h视频在线观看免费 | 精品乱码一区二区三四区视频 | www.天堂av.com | 亚洲天堂一区 | 伊人网影院 | 国产精品二区三区 | 久久久久久91 | 91精品国产91久久久久久吃药 | 992人人草 | 成人av网站在线观看 | 欧美一区二区三区视频在线播放 | 亚洲福利片 |