Computer problems,Computer help
*AX SOFT>>>Programming & Design

Write a JAVA program to check whether a Character is a VOWEL or NOT???


\\well this is the one that i hve tried.. but its not working... im having problems in declaring characters... guys pls help me out!!!

import java.io.*;

class q11
{
public static void main (String ss[])throws IOException
{
char n;

BufferedReader s=new BufferedReader (new InputStreamReader (System.in));

System.out.println ("Enter a Charcter");
n=Integer.parseInt(s.readLine());


if (n=='a'|| n=='e'|| n=='i'|| n=='o'|| n=='u'|| n=='A'|| n=='E'|| n=='I'|| n=='O'|| n=='U')

System.out.println ("Entered character is a Vowel");
else
System.out.println ("Entered character is not a Vowel");

}
}

Replace the line
n=Integer.parseInt(s.readLine());
with
n=s.readLine().charAt(0);

The Integer.parseInt() method returns an int, but you're assigning it to a char n without a cast... but then, the code still won't work, because the Integer.parseInt() method takes in a String which is made out an integer, but your input is a character, so you will have a NumberFormatException.

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • When I google my site I do not see the home page on the list that appear but rather the privacy policy, why?

    Worry not, you can fix this with a little research and elbow grease. Basically, Google decides what and where information is displayed in their search results. These decisions are made by very ...

  • What is the best way to create a site map or what is the best software to use for sitemaps?

    I almost never create one "from scratch" ... instead, I have a plug-in for a content management system generate the site map for me. This has the additional benefit of not only generating...

  • How do I access my database?

    It depends on the configuration of the MySQL server, which by default is indeed locked to your domain. SOME web hosts allow you to specify additional IP addresses for access, and if you have that c...

  • Help To find this book ?

    Check the source.

    ...
  • When we should (in what situation/scenario) we are supposed to use inline function in spite of normal function

    I use Visual Basic, which has no such thing. However, if I remember correctly, the Inline keyword forces the code of the method being called to be compiled in-line (hence the name). So, inste...

  • <header.h> / "header.h" mein difference and normal function /inline function mein difference?

    <header.h> :means it execute or it include the only that file which are belonging or present in a TC folder header.h :means it execute all the header files which r present in u r hard dis...

  • EdgeCam Help?

    May be you can contact a edgecam expert live at website like ...

  • Array of Structures?

    Yes. Contrary to what the previous responder said, structure assignment, as shown in your example, is valid in ANSI C.

    ...
  •  

    Categories--Copyright/IP Policy--Contact Webmaster