英文:
There is no syntax error in this program, but the values aren't coming as intended.....How can I make this program run?
问题
I'm a newbie to Java, and haven't completed learned it yet. Still, I'm trying my best to solve as many problems as possible and get better.
So my query is, how can this program be fixed ??
The output is something like (https://i.stack.imgur.com/c4qCn.jpg)
Someone please correct this program, without removing the Scanner class.
I really tried to make this program run, but it just wasn't working. The values were always 0 or 0.0, no matter what I did....
Can someone also explain what went wrong here ??
Thank you in advance.🤗🤗
英文:
(https://i.stack.imgur.com/kDec2.jpg)
I'm a newbie to Java, and haven't completed learned it yet. Still, I'm trying my best to solve as many problems as possible and get better.
So my query is, how can this program be fixed ??
The output is something like (https://i.stack.imgur.com/c4qCn.jpg)
Someone please correct this program, without removing the Scanner class.
I really tried to make this program run, but it just wasn't working. The values were always 0 or 0.0, no matter what I did....
Can someone also explain what went wrong here ??
Thank you in advance.🤗🤗
答案1
得分: 1
你需要使用_ob_实例来访问_a_和_b_。
ob.a = sc.nextDouble();
ob.b = sc.nextDouble();
英文:
You'll need to use the ob instance to access a and b.
ob.a = sc.nextDouble();
ob.b = sc.nextDouble();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论