Showing posts with label Selection. Show all posts
Showing posts with label Selection. Show all posts

Friday, October 30, 2009

Published 10/30/2009 by with 1 comment

incompatible types

1. Sometimes we may get the following error message in an 'if' (selection) structure. incompatible typesfound : intrequired: boolean This is because, we have not specified a boolean expression as the condition of the 'if'; instead we might have written such an expression which is may be int, float, String or other types but not boolean. See the code below: int a=10,b=10; if(a=b){ System.out.println("a...
Read More
    email this       edit

Tuesday, November 4, 2008

Published 11/04/2008 by with 0 comment

else without if

Programmers may see message “else without if” when the selection (if ... else if ... else) structure is used. This may happen for any of the following reasons: Semicolon (;) is given after the last parenthesis of the condition Error in use of the curly braces ( } ), may be the } is not closed before starting the next else if or the else or } is given more. Here is an example of this error: public...
Read More
    email this       edit