我有这个程序,我想知道我的错误,请帮助我。谢谢你 [英] i hav this program and i want to know wats my error pls help me.thank u
本文介绍了我有这个程序,我想知道我的错误,请帮助我。谢谢你的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
展开 | 选择 | Wrap | 行号
推荐答案
这样的课程没有按预期运行?然后*它做了什么*和它应该做什么*
?你不能让我们猜,请告诉我们错误是什么?
是/;你从编译器或JVM本身得到错误诊断
请向我们展示。这不是一个猜谜论坛。
亲切的问候,
Jos
So that class doesn''t run as you expected? Then *what* does it do and *what*
is it supposed to do? You can''t make us guess, please tell us what the error(s)
is/are; it you get error diagnostics either from the compiler or the JVM itself
please show them to us. This is not a guessing forum.
kind regards,
Jos
输入类型货币:
美元,瑞士法郎,欧元,墨西哥比索
swissfrancs(我输入的货币)
(这是错误)
线程main中的异常java.util.InputMismatchException
at java.util.Scanner.throwFor< Scanner.java:840>
at java.util.Scanner.next< Scanner.java:1461> ;
at java.util.Scanner.nextDouble< Scanner.java:2387>
at trixie.main< trixie.java:13>
按任意键继续...
Enter the type of currency:
Dollars, Swiss Francs, Euro dollars, Mexican pesos
swissfrancs(the currency i entered)
(this is the error)
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor<Scanner.java:840>
at java.util.Scanner.next<Scanner.java:1461>
at java.util.Scanner.nextDouble<Scanner.java:2387>
at trixie.main<trixie.java:13>
Press any key to continue...
输入货币类型:
美元,瑞士法郎,欧元,墨西哥比索
swissfrancs(我输入的货币)
(这是错误)
线程中的异常main java.util.InputMismatchException
at java.util.Scanner.throwFor< Scanner.java:840>
at java.util.Scanner.next< Scanner.java:1461> ;
at java.util.Scanner.nextDouble< Scanner.java:2387>
at trixie.main< trixie.java:13>
Enter the type of currency:
Dollars, Swiss Francs, Euro dollars, Mexican pesos
swissfrancs(the currency i entered)
(this is the error)
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor<Scanner.java:840>
at java.util.Scanner.next<Scanner.java:1461>
at java.util.Scanner.nextDouble<Scanner.java:2387>
at trixie.main<trixie.java:13>
是的,您的扫描仪在主方法的第13行抛出异常
(读取打印的堆栈跟踪)。当你输入
''swissfrancs''时,你把它读成了一个双倍价值,这肯定不代表双重价值。
更好地制作用户输入一个字符并用一个小菜单提示她;
类似于:
Yep, your Scanner is throwing an exception in line 13 of your main method
(read the printed stack trace). You made it read a double value while you typed
''swissfrancs'' which most certainly doesn''t represent a double value.
Better make the user type a single character and prompt her with a little menu;
something like:
展开 | 选择 | 换行 | 行号
这篇关于我有这个程序,我想知道我的错误,请帮助我。谢谢你的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文