mysql - I cannot extend the class in java -
mysql - I cannot extend the class in java -
this may 1 class. want create new class registrationvalidator
extending loginvalidator
. tried
public class registrationvalidator extends loginvalidator { }
but show error in netbeans...what soluation?
public loginvalidator() throws sqlexception{ seek { connect = new dbconnect(); st = connect.statement(); } grab (sqlexception ex) { logger.getlogger(mainframe.class.getname()).log(level.severe, null, ex); } } public int validator(string mobileno,string pass){ int ret = 0; try{ string query="select * login mobileno='"+mobileno+"'"; res= st.executequery(query); while(res.next()){ string dbmobileno=res.getstring("mobileno"); string dbpass=res.getstring("password"); if(mobileno.equals(dbmobileno) && pass.equals(dbpass)){ ret=1; } else if(mobileno.equals(dbmobileno)){ ret=2; } } }catch(sqlexception ex){ system.out.println("sql execption: "+ex); system.out.println("3"); } homecoming ret; } }
a few things here.
you can define 1 public class per java file. registrationvalidator class should in own java file, separate loginvalidator class. since catching sqlexception , logging info, don't need "throws sqlexception" constructor signature loginvalidator() java mysql extends
Comments
Post a Comment