Java计算器 [英] Java Calculator

查看:94
本文介绍了Java计算器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用java而我正在尝试制作一个简单的计算器,但我很困惑为什么我一直收到警告信息。

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

解决方案


我刚开始使用java而我正在尝试制作一个简单的计算器,但我很困惑为什么我一直收到警告信息。

< span class =codeLinkonclick =Blur(this,t his.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号



如果你对代码发出警告就没关系了。

你声明并初始化d1和d2但是还没有在你的代码中使用它们......所以有警告显示。



感谢您的快速回复...我想我认为那部分...现在我在添加if语句时遇到问题......我我试图说我的算子是否等于''+''那么应该加上2个数字。就像,我说,我对此很新,所以如果我犯了愚蠢的错误,我道歉......这就是我到目前为止所做的:

展开 | 选择 | Wrap | 行号



感谢您的快速回复...我想我认为那部分...现在我有了添加if语句的问题......我试图说我的运算符是否等于''+''那么应该添加2个数字。就像,我说,我对此很新,所以如果我犯了愚蠢的错误,我道歉......这就是我到目前为止所做的:

展开 | 选择 | Wrap | 行号< /跨度>

I have just started using java and I''m trying to make a simple calculator, but I''m confused as to why I keep getting a warning message.

Expand|Select|Wrap|Line Numbers

解决方案

I have just started using java and I''m trying to make a simple calculator, but I''m confused as to why I keep getting a warning message.

Expand|Select|Wrap|Line Numbers


it doesn''t matter if you get warning on the code.
You declare&initialise d1 and d2 but not yet use them in your code...so there are warning show up.


Thanks for the quick reply...I think I figured that part out...now I''m having a problem adding if statements...I''m trying to say if my operator is equal to ''+'' then the 2 numbers should be added. Like, I said, I''m very new at this, so I apologize if I make stupid mistakes...this is what I have so far:

Expand|Select|Wrap|Line Numbers


Thanks for the quick reply...I think I figured that part out...now I''m having a problem adding if statements...I''m trying to say if my operator is equal to ''+'' then the 2 numbers should be added. Like, I said, I''m very new at this, so I apologize if I make stupid mistakes...this is what I have so far:

Expand|Select|Wrap|Line Numbers


这篇关于Java计算器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆