This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 37913
    
  22
. . . 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: 37913
    
  22
. . . which is why using == true or == false is not only bad style, but potentially error-prone if you writey = instead of ==.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: incompatable types.
 
Similar Threads
[solved]warning message:" Accessing static method numbers" #7th floor
SoDuko puzzle
Create a counter that increments once a second until a given number of seconds is reached
Stacks
index value