Does java use BODMAS?

邮差的信 提交于 2021-02-17 05:34:12

问题


At the moment, I'm trying to make a calculator using the java programming language. However, I need to know whether or not java uses BODMAS so that I'll know whether to make an algorithm that implements BODMAS or continue making the calculator. Does java use BODMAS?


回答1:


It's BODMAS not BOMDAS (division is before multiplication).

Yes Java does, there is also precedence rules that it uses about operators not included in BODMAS too

A full list can be found in the Java documentation here:

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html




回答2:


First, thanks for asking the question. I personally have never heard the term BODMAS. Now I know that it means :

B
Brackets first
O
Orders (ie Powers and Square Roots, etc.)
DM
Division and Multiplication
AS
Addition and Subtraction

So, I personally do not know language that does not support BODNAS internally. I however cannot understand how do you want to use this fact when implementing your calculator.



来源:https://stackoverflow.com/questions/20594253/does-java-use-bodmas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!