Java Error incompatible types occurred when a compiler found a variable and expression whose data type is not compatible to perform an operation on them.
In this Tutorial we want to describe you a code that help you in understanding the java error incompatible type. For this we have a class name Incompatobletype.Inside the main method we declare a variable name roll num and sec int and char data type. Checklist condition is used to evaluate the expression. The assignment operator = is used to show you an incompatible type error in java rather than using = = in assignment operator. The Java Compiler show an error in the assignment operator printed by System.out.println.
Incompatitabletype.java
|
|
Compiling 1 source file to /home/girish/NetBeansProjects/errors/build/classes /home/girish/NetBeansProjects/errors/src/Icompatobletype.java:8: incompatible types found : int required: boolean if (rollnum = 90) { 1 error BUILD FAILED (total time: 0 seconds) |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java error incompatible types View All Comments
Post your Comment