• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

else with out if

 
sandeep Talari
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.util.*;

<blockquote>code:
<pre name="code" class="core">public class BeerExpert
{
public List getBrands(String color)
{
List brands= new ArrayList();
if(color.equals("Green"));
{
brands.add("This is what i sujjested green");
brands.add("And simply proceed for that");
}
else{
brands.add("average");
brands.add("nobody uses this ");
}
return (brands);
}
}
</pre>
</blockquote>

i'm un able to find the problem .

[edit]Add code tags. CR[/edit]
[ July 17, 2008: Message edited by: Campbell Ritchie ]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15627
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this line:

if(color.equals("Green"));

There is a ; that should not be there.
 
Rakesh Chaudhary
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh that was very Fast jasper

I was compiling it to find the error..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic