• Post Reply Bookmark Topic Watch Topic
  • New Topic

error???  RSS feed

 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can somebody explain to me what are these error....

incompatible type???
 
Vicken Karaoghlanian
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This error usually occurs when you have provided a data that wasn't of the type expected, and java cannot do an implicit conversion.

For example, assigning a String to a Boolean:


You way want to post your code in order for us to have a clear view of the problem you are having.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an eample of code producing the compile time error Incompatible Types:


The if statement is expecting a boolean, but because the programmer has written a = b the if is being given an int (that's the type of the result of the assignment statement in this case). So the compiler is complaining that type int is incompatible with the expected type boolean.

Without seeing your code producing the same error it is rather difficult to help you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!