{"id":1341,"date":"2022-03-03T07:07:29","date_gmt":"2022-03-03T07:07:29","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1341"},"modified":"2022-03-03T07:07:29","modified_gmt":"2022-03-03T07:07:29","slug":"check-vowel-or-consonant","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/03\/03\/check-vowel-or-consonant\/","title":{"rendered":"Check Vowel or Consonant"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Check vowel or consonant using if..else statement<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>public class VowelConsonant {\n\n    public static void main(String&#91;] args) {\n\n        char ch = 'i';\n\n        if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )\n            System.out.println(ch + \" is vowel\");\n        else\n            System.out.println(ch + \" is consonant\");\n\n    }\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><samp>i is vowel<\/samp><\/code><\/pre>\n\n\n\n<p>In the above program,&nbsp;<code>'i'<\/code>&nbsp;is stored in a char variable&nbsp;<var>ch<\/var>. In Java, you use double quotes&nbsp;<code>(\" \")<\/code>&nbsp;for strings and single quotes&nbsp;<code>(' ')<\/code>&nbsp;for characters.<\/p>\n\n\n\n<p>Now, to check whether&nbsp;<var>ch<\/var>&nbsp;is vowel or not, we check if&nbsp;<var>ch<\/var>&nbsp;is any of:&nbsp;<code>('a', 'e', 'i', 'o', 'u')<\/code>. This is done using a simple&nbsp;<code>if..else<\/code>&nbsp;statement.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Check vowel or consonant using if..else statement Output In the above program,&nbsp;&#8216;i&#8217;&nbsp;is stored in a char variable&nbsp;ch. In Java, you use double quotes&nbsp;(&#8221; &#8220;)&nbsp;for strings and single quotes&nbsp;(&#8216; &#8216;)&nbsp;for characters. Now, to check whether&nbsp;ch&nbsp;is vowel or not, we check if&nbsp;ch&nbsp;is any of:&nbsp;(&#8216;a&#8217;, &#8216;e&#8217;, &#8216;i&#8217;, &#8216;o&#8217;, &#8216;u&#8217;). This is done using a simple&nbsp;if..else&nbsp;statement.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[350],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1341"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1341"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1341\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}