Error of missing return statement while implementing Array
hi all.
this is my first post in here.
i have problem in return type but :-?? can help me ?
this is my code :
Code :
public ArrayList<Operator> getlist() throws ClassNotFoundException, SQLException{
ArrayList<Operator> operators = null;
Operator operator= null;
Command_msg = "SELECT * FROM Operator";
connection = DBCore.Conn();
statement = connection.createStatement();
ResultSet rs = statement.executeQuery(Command_msg);
operators = new ArrayList<Operator>();
while(rs.next()){
operator = new Operator();
operator.setUsername(rs.getString("Username"));
operator.setPassword(rs.getString("Password"));
operator.setName(rs.getString("Name"));
operators.add(operator);
return operators;
and
Code :
//create object From Operator
private Operator operator;
//create array of Operators
private Operator[] operators;
know the error is : missing return Statement
Re: Problem in Array return type
Count your curly braces {}. The compiler thinks your return statement is inside the loop. Code indentation is for human eyes, the compiler ignores it.