Ternary operator to return value- Java/Android

后端 未结 5 698
情深已故
情深已故 2021-02-07 01:13

Just switched to Java from php

I encountered following issue

I want to rewrite

if(usrname.equals(username) && (passwd.equals(password))){         


        
5条回答
  •  北海茫月
    2021-02-07 01:59

    Why redundant boolean

    Just use

    return  (usrname.equals(username) && passwd.equals(password));
    

提交回复
热议问题