Java:当您尝试使绝对值类为负数时会发生什么?

huangapple go评论54阅读模式
英文:

Java: What happens when you try to make the Absolute Value Class negative?

问题

System.out.println(-Math.abs(-14));

这将打印 -14 还是会忽略 Math.abs 代码外面的负号?

英文:

If I were to print

System.out.println(-Math.abs(-14));

would it print -14 or would it disregard the negative sign on the outside of the Math.abs code?

答案1

得分: 1

你会得到-14。请先尝试运行您的代码,以查看其行为。

英文:

You will get -14. Please go try your code first to see its behaviour

huangapple
  • 本文由 发表于 2020年7月23日 03:34:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/63041902.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定