{"id":2727,"date":"2017-06-26T05:23:07","date_gmt":"2017-06-26T05:23:07","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=2727"},"modified":"2021-03-21T06:24:55","modified_gmt":"2021-03-21T06:24:55","slug":"relational-operator-greater-than-in-java","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/relational-operator-greater-than-in-java\/","title":{"rendered":"Relational Operator greater than in Java"},"content":{"rendered":"<h3>Introduction<\/h3>\n<p>Relation operator <strong>Greater Than( &gt; )<\/strong> and the operator <strong>Greater than Equal to (&gt;=)<\/strong> compares two variables for the relation greater than or greater than equal to.<\/p>\n<h3>&gt; Relational Operator<\/h3>\n<p>a &gt; b\u00a0 evaluates to <strong>true<\/strong> if a is <strong>greater than<\/strong> b else <strong>false<\/strong><\/p>\n<p>Similarly,<\/p>\n<p>a &gt;= b evaluates to <strong>true<\/strong> if a is <strong>greater than Equal to<\/strong> b else <strong>false<\/strong><\/p>\n<h3>Code Listing<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/\/GreaterThanOperatorDemo.java\r\n\/\/www.TestingDocs.com\r\npublic class GreaterThanOperatorDemo {\r\n\r\n  public static void main(String[] args) {\r\n    int a = 10;\r\n    int b = 20;\r\n    if(a &gt; b ) {\r\n      System.out.println(\"a is greater than b\");\r\n    }\r\n    else {\r\n      System.out.println(\"a is not greater than b\");\r\n    }\r\n    System.out.println(\"The expression a &gt; b evaluates to = \" + (a &gt; b));\r\n  }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Sample Output<\/h3>\n<p>a is not greater than b<br \/>\nThe expression a &gt; b evaluates to = false<\/p>\n<h3>Screenshot<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2732\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Relational-Operator-greater-than-Java.png\" alt=\"greater than relational operator\" width=\"1739\" height=\"1027\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Relational-Operator-greater-than-Java.png 1739w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Relational-Operator-greater-than-Java-300x177.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Relational-Operator-greater-than-Java-1024x605.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Relational-Operator-greater-than-Java-768x454.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Relational-Operator-greater-than-Java-1536x907.png 1536w\" sizes=\"auto, (max-width: 1739px) 100vw, 1739px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>&gt;= Relational Operator<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/\/GreaterThanEqualToOperatorDemo.java\r\n\/\/www.TestingDocs.com\r\npublic class GreaterThanEqualToOperatorDemo {\r\n\r\n  public static void main(String[] args) {\r\n    int a = 20;\r\n    int b = 20;\r\n    if(a &gt;= b ) {\r\n      System.out.println(\"a is greater than or Equal to b\");\r\n    }\r\n    else {\r\n      System.out.println(\"a is not greater than or Equal to b\");\r\n    }\r\n    System.out.println(\"The expression a &gt; b evaluates to = \" + (a &gt;= b));\r\n  }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-2727\" data-postid=\"2727\" class=\"themify_builder_content themify_builder_content-2727 themify_builder tf_clear\">\n    <\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Introduction Relation operator Greater Than( &gt; ) and the operator Greater than Equal to (&gt;=) compares two variables for the relation greater than or greater than equal to. &gt; Relational Operator a &gt; b\u00a0 evaluates to true if a is greater than b else false Similarly, a &gt;= b evaluates to true if a is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"class_list":["post-2727","post","type-post","status-publish","format-standard","hentry","category-java","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/2727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=2727"}],"version-history":[{"count":3,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/2727\/revisions"}],"predecessor-version":[{"id":19727,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/2727\/revisions\/19727"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=2727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=2727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=2727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}