英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论