判断

package cn.itcast.day04.demo03;
/*
题目要求
定义一个方法,用来判断俩个数字是否相同。
 */
public class Demo01MethodSame {
    public static void main(String[] args) {
        System.out.println(isSame(18,10));

    }
    /*
    三要素;
    返回值类型;boolean
    方法名称;isSame
    参数列表;int 啊,int b
     */
    public static boolean isSame(int a,int b){
        //boolean same;
       /* if (a==b){
            same = true;
        }else {
            same =false;
        }*/
       //same = a == b ? true: false;
        /*
        boolean same = a == b;
        return  same;

         */
        return  a == b;

    }
}

 

posted @ 2020-03-08 17:00  汉魂县令  阅读(61)  评论(0)    收藏  举报