Java Program to check whether the entered value is ASCII 7-bit alphabetic lowercase

Java 8Object Oriented ProgrammingProgramming

<p>To check whether the entered value is ASCII 7-bit alphabetic lowercase, check the character from &lsquo;a&rsquo; to &lsquo;z&rsquo;.</p><p>Here, we have a character.</p><pre class="result notranslate">char one = &#39;m&#39;;</pre><p>Now, we have checked a condition with if-else to check for lowercase character from &lsquo;a&rsquo; to &lsquo;z&rsquo;</p><pre class="prettyprint notranslate">if (one &gt;= &#39;a&#39; &amp;&amp; one &lt;= &#39;z&#39;) { &nbsp; &nbsp;System.out.println(&quot;Given character is in lowercase!&quot;); } else { &nbsp; &nbsp;System.out.println(&quot;Given character is not in lowercase!&quot;); }</pre><h2>Example</h2><p><a class="demo" href="http://tpcg.io/QMwgbg" rel="nofollow" target="_blank">&nbsp;Live Demo</a></p><pre class="prettyprint notranslate">public class Demo { &nbsp; &nbsp;public static void main(String []args) { &nbsp; &nbsp; &nbsp; char one = &#39;m&#39;; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Character: &quot;+one); &nbsp; &nbsp; &nbsp; if (one &gt;= &#39;a&#39; &amp;&amp; one &lt;= &#39;z&#39;) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Given character is in lowercase!&quot;); &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Given character is not in lowercase!&quot;); &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp;} }</pre><h2>Output</h2><pre class="result notranslate">Character: m Given character is in lowercase!</pre><p>Let us see another example.</p><h2>Example</h2><p><a class="demo" href="http://tpcg.io/KiE2WP" rel="nofollow" target="_blank">&nbsp;Live Demo</a></p><pre class="prettyprint notranslate">public class Demo { &nbsp; &nbsp;public static void main(String []args) { &nbsp; &nbsp; &nbsp; char one = &#39;N&#39;; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Character: &quot;+one); &nbsp; &nbsp; &nbsp; if (one &gt;= &#39;a&#39; &amp;&amp; one &lt;= &#39;z&#39;) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Given character is in lowercase!&quot;); &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Given character is not in lowercase!&quot;); &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp;} }</pre><h2>Output</h2><pre class="result notranslate">Character: N Given character is not in lowercase!</pre>
raja
Updated on 26-Jun-2020 06:57:14

Advertisements