Just switched to Java from php
I encountered following issue
I want to rewrite
if(usrname.equals(username) && (passwd.equals(password))){
Java ternary operator is an expression, and is thus evaluated to a single value. As per the Javadocs, for below given expression
result = someCondition ? value1 : value2;
if the boolean condition is true then assign the value of value1 to the result, else assign value2 to the result. Both value1 and value2 should be of same value type.
Hence the correct syntax of a return statement would be
return boolean_condition ? value_when_true : value_when_false