Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Returning void?

807607Nov 30 2006 — edited Dec 1 2006
Hello!
I get the error " cannot return a value from method whose result type is void"
This is my first try at returning a value with a return statement. The code works fine .... just the return val part is not.
public class Calculate_11AM_Minutes {
    
    /** Creates a new instance of Calculate_11AM_Minutes */
    public Calculate_11AM_Minutes() {
        
        SimpleDateFormat formatter_3 = new SimpleDateFormat("mm");// Mins Time Only !
        Date currentTime_3 = new Date();
        String MM = formatter_3.format(currentTime_3);
        
        
        for ( int min_row=0; min_row<59; min_row++ ) { 
            
            
            Object X_min_0 = AddRFSwitchMain.jTable3.getModel().getValueAt(min_row,0);
            String min_0 = X_min_0.toString();
                    
 
        if (MM.equals(min_0)){ //search for a match in look-up table
            Object tab_min_1 = AddRFSwitchMain.jTable3.getModel().getValueAt(min_row,1);
            int MIN_Multi = Integer.parseInt((String) tab_min_1);// this is the multiply by value of the matching time
            long MIN_Mills = (MIN_Multi * 60000); 
            
            return MIN_Mills;  //return MIN_Mills value here  
            }
            continue;
            }
  
    }
    
}
.... I make call to this code above like this:
Calculate_11AM_Minutes  MIN_Mills = new Calculate_11AM_Minutes();
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2006
Added on Nov 30 2006
20 comments
321 views