Incompatible Types - found:int required:boolean

后端 未结 3 1239
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-22 03:00

I\'m trying to display: EQUIVALENT if the first numerical input is equal to the second input. What\'s wrong with my code?

import java.io.*;
public class TwoNum{
         


        
3条回答
  •  忘掉有多难
    2021-01-22 03:35

    Use

     if(number==number2)
    

    Instead of

     if(number=number2)
    

    The first compares number2 to number and if they are equal evaluates to true. The second assigns the value of number2 to the variable number and the expression evaluates to number/number2, an int.

    Link

    • Summary of Operators (The Java Tutorials)

提交回复
热议问题