Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Program to test if a character is uppercase/lowercase/number/vowel
    text
    copied!<p>As I said before, how do I test if the entered character is one of the parameters? I've written this code, but it doesn't seem to run very well(or at all), no errors, however. Also, I need to use the basic code I've used here. Its for school and we lose points if we use things they haven't taught us (darn school). </p> <pre><code>class doody { public static void main(String[] args) { char i; char input='D'; for(i='A';i&lt;='Z';i++)//check if uppercase { if(input==i){ System.out.println("Uppercase"); switch(input){ case 'A': case 'E': case 'I': case 'O': case 'U': System.out.println("Vowel"); break; default: System.out.println("Not a vowel"); break;} } for(i='a';i&lt;='z';i++)//check if lowercase { if(input==i){ System.out.println("Lowercase"); switch(input){ case 'a': case 'e': case 'i': case 'o': case 'u': System.out.println("Vowel"); break; default: System.out.println("Not a vowel"); break; }} for(i='0';i&lt;='9';i++)//check if number { if(input==i) System.out.println("Number"); } } }}} </code></pre> <p>Edit: Here is some code I threw together today. Much simpler. I don't know why this didn't occur to me earlier. It was probably because I was groggy, it was late.</p> <pre><code>class doody { public static void main(String[] args) { char input='$';//input here. boolean lorn=false; if(input&gt;='a'&amp;&amp;input&lt;='z') {System.out.println("Lowercase"); lorn=true; if(input=='a')System.out.println("Vowel."); if(input=='e')System.out.println("Vowel."); if(input=='i')System.out.println("Vowel."); if(input=='o')System.out.println("Vowel."); if(input=='u')System.out.println("Vowel."); } if(input&gt;='A'&amp;&amp;input&lt;='Z') {System.out.println("Uppercase"); lorn=true; if(input=='A')System.out.println("Vowel."); if(input=='E')System.out.println("Vowel."); if(input=='I')System.out.println("Vowel."); if(input=='O')System.out.println("Vowel."); if(input=='U')System.out.println("Vowel."); } if(input&gt;='0'&amp;&amp;input&lt;='9') { lorn=true; System.out.println("Number"); } if(lorn==false)System.out.println("It is a special character"); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload