Here is a my code
public boolean changePassword(String password, String id) {
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DBuser, DBpassword);
Statement st = conn.createStatement();
String updateQuery = "update teacher_registration set password="+password+"where teacher_id="+id;
ResultSet rs = st.executeQuery(updateQuery);
if(rs!=null){
return true;
}else{
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
I want to return true if rs is not null else return false.
But i am getting an error at the closing bracket of this method. It is asking me to return a true or false again even if I did so in the try catch block earlier.
This is my first time working with java.
Please HELP!