aspose file tools
The moose likes Swing / AWT / SWT and the fly likes  java awt if statement not working properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark " java awt if statement not working properly" Watch " java awt if statement not working properly" New topic
Author

java awt if statement not working properly

Vaibhav Kaushal
Greenhorn

Joined: Jun 25, 2013
Posts: 5
it is a program to find vowels from tect in awt....but it is not doing so may be some problem in if statement


Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42955
    
  73
Strings are not compared using the "==" operator, but using the "equals" method.

Start by rewriting your code to use

char vowels[]={'a','e','i','o','u'}

instead of

String vowels[]={"a","e","i","o","u"}

If you do that, note that char is compared using "==", unlike String.

Once you got all this working, ask yourself whether é is a vowel for your purposes :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java awt if statement not working properly