Missing return statement making triangle program

后端 未结 4 551
花落未央
花落未央 2021-01-27 09:24
public String displayType(int side1, int side2,int side3)
    {
        if(( side1+side2 > side3))

            if(( side1==side2) && (side2==side3))//tell if         


        
4条回答
  •  一生所求
    2021-01-27 09:41

    The reason is that, What happens all of your conditions failed to execute ??

    Possible solutions :

    • You need to provide an else block there.When you provide a else block, then it is sure that always there is a chance to return the value, either in if or in else .

    • A default return statement without regarding if-else, where the returning value should be decide in blocks.

提交回复
热议问题