{"id":103,"date":"2023-02-18T06:43:21","date_gmt":"2023-02-17T22:43:21","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=103"},"modified":"2023-02-18T06:44:10","modified_gmt":"2023-02-17T22:44:10","slug":"bigdecimal-comparison-equals-compareto","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/18\/bigdecimal-comparison-equals-compareto\/","title":{"rendered":"BigDecimal\u6bd4\u8f83\u76f8\u7b49\uff0c\u4e0d\u80fd\u7528equals\uff0c\u8981\u7528compareTo"},"content":{"rendered":"<p>BigDecimal\u6bd4\u8f832\u4e2a\u503c\u662f\u5426\u76f8\u7b49\uff0c\u4e0d\u80fd\u7528equals\uff0c\u800c\u8981\u7528compareTo<\/p>\n<pre><code class=\"language-java\">public class BigDecimalTest {\n\n    public static void main(String[] args) {\n        BigDecimal b1 = BigDecimal.valueOf(-1);\n        BigDecimal b2 = BigDecimal.valueOf(-1.0);\n        System.out.print(b1.equals(b2));  \/\/false\n    }\n}<\/code><\/pre>\n<pre><code class=\"language-java\">public class BigDecimalTest {\n\n    public static void main(String[] args) {\n        BigDecimal b1 = BigDecimal.valueOf(-1.0);\n        BigDecimal b2 = BigDecimal.valueOf(-1.0);\n        System.out.print(b1.equals(b2));  \/\/true\n    }\n}<\/code><\/pre>\n<pre><code class=\"language-java\">public class BigDecimalTest {\n\n    public static void main(String[] args) {\n        BigDecimal b1 = BigDecimal.valueOf(-1);\n        BigDecimal b2 = BigDecimal.valueOf(-1.0);\n        System.out.print(b1.compareTo(b2) == 0);  \/\/true\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>BigDecimal\u6bd4\u8f832\u4e2a\u503c\u662f\u5426\u76f8\u7b49\uff0c\u4e0d\u80fd\u7528equals\uff0c\u800c\u8981\u7528compareTo public class [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-java-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=103"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/103\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}