vendredi 2 décembre 2016

True or false as a result and why

If I have one piece of code

public boolean login(String username, String pass) throws SQLException{
Connection conn = connect();
PreparedStatement st = conn.prepareStatement("select * from users where ime = ? and sifra = ?");
st.setString(1, username);
st.setString(2, pass);
ResultSet rs = st.executeQuery();
return rs.next();
}

and another

if(login(creds[0], creds[1]))

Why is result of "if" statement true or false. I know that is true or false but i can't understand it why. I am missing some brain information. Can someone chew it for me step by step? Thanks in advanced!

Aucun commentaire:

Enregistrer un commentaire