*
The moose likes Beginning Java and the fly likes incompatable types. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "incompatable types." Watch "incompatable types." New topic
Author

incompatable types.

theodore sklavenitis
Greenhorn

Joined: Dec 16, 2010
Posts: 4






thanks to everyone that responed to my previous problem.Here in my displaytable method my if statments give me an error that say incompatable types required boolean found int.Any tips?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Use "==" to compare variables. "=" is used for assignment.


[My Blog]
All roads lead to JavaRanch
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
. . . and why are you using all those if blocks rather than

array[n]++

?
Marcin Majewski
Greenhorn

Joined: Dec 20, 2010
Posts: 14

You are not allowed to place assignments (=) in if statements. You are only allowed to make comparisons in if statements (==) and call methods that return boolean. This is a Java build-in security checking mechanism.


Check out my site at whizzarts.pl
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Marcin Majewski wrote:You are not allowed to place assignments (=) in if statements.


Marcin Majewski
Greenhorn

Joined: Dec 20, 2010
Posts: 14

Good point. Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
. . . which is why using == true or == false is not only bad style, but potentially error-prone if you writey = instead of ==.
 
 
subject: incompatable types.