java - Class Cast Exception when casting double -
I tried to run the following code, it compiles, but class class throws the extension. I'm really glad if someone can help me. Why
double costprice = 0; Object [] possibilities = null; CostPrice = (Double) Joppenpen. Shoinputdialog (Alpha POS, "Cost Price:", "Enter Value", Joppenpen. PLAIN_MESSAGE, Blank, Prospects, "");
answerpace.shoinputdomog () a The object is attributed to the (@SeleenVirtuose) which can not be inserted in double , using double.parseDouble () to parse the string as double To do it.
costprice = double. PRSDB (Joppenpen. ShowInputDialog (alpha POS, "cost price:", "enter value", joppenpane.plin_msassage, empty, possibilities, "")); In addition, you can do all this on one line
As you are declaring the double variable and then directly setting You are probably declaring it as well and assign a new value to a line
double costprice = double. PRSD Double (JoptionPan.ShownputDialog (Alpha POS, "Cost Price:", "Enter Value", Joppenpen. PLIN_MASSEge, Zero, Prospects, "")); In addition to this, as probes variable is zero, simply pass null as the parameter (unless you go anywhere else Do not change)
Double CostPrice = Double. PRSDB (Joppenpen Shine InputDialog (Alpha POS, "Cost Price:", "Enter Value", Joppenpen. PLAIN_MESSAGE, Blank, Faucet, ""););
Comments
Post a Comment