Getting a "Return" error message when compiling

I have the following code below that works when I don't use any methods.
When I insert the side method(), I always get an error message "missing return statement".
I can't figure out what I am doing wrong.
It runs fine as it is but I am trying to modify it by using separate methods (just to learn how to use and call methods).
I am trying to replace what I have in the main method in separate method called "side".
Here is the code
import javax.swing.*;
public class Round
private String output = "";
    //message error occurs when this method is added;   
   public String side()
         for (int row  = 1; row <=5 ; row ++)
           if (row == 1 || row == 5)
            return output += "      * *  \n"; 
    public static void main(String args[])
        String output = "";
  //the for loop (before the else) is copied into the side method. 
         for (int row  = 1; row <=5 ; row ++)
           if (row == 1 || row == 5)
             output += "      * *  \n"; 
           else
             if (row == 2 || row ==4)
             output += " *           * \n"; 
           else                     
             output += "*              *\n";
        JOptionPane.showMessageDialog(null,output); 
        System.exit(0);
}Thanks for your help.

I did as you suggested and still get the same results.
I also tried using on one return statement after the for loop but still got an error message.
Do you know how I can fix this?
thanks
     public String side()
         for (int row  = 1; row <=5 ; row ++)
           if (row == 1 || row == 5)
            return output += "      * *  \n"; 
           else
             if (row == 2 || row ==4)
             return output += " *           * \n"; 
           else                     
            return output += "*              *\n";
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

Maybe you are looking for

  • Third party sales configuration

    Dear I needed your guidance for third party sales when vendor supply the material to the customer we keep item category group BANS and stock entered virtually in our stock and then vendor invoice generated and received by the company through MIGO and

  • Would like to buy an notebook with 16:10 screen

    Hi, I would like buy a new portable computer with 16/10 screen ( and not 16/9 ! ). Where I can find these ? Thank you.

  • Error in creating EUL

    Hi all, Please can you help me with that Error: When i create EUL the following error occured:- "The following error occured while installation(see eulinst.log for details)-install failed, cause:ORA-00603:oracle server terminated by fatel error". the

  • Can a Java app run in the background?

    I want to put an app on a server that runs at a certain time of day (probably something like midnight, not sure yet) that just performs a task without any notifications. Is Java suitable for this task?

  • Dell Inspiron 7537 - Issues

    I purchased the Inspiron 7537 (i7 4500U, 8gb RAM, Nvidia GT750M). Issues: 1. Hiss noise from headphone socket (Same as my Studio 1558, DELL's RnD is a bullshit) 2. Wifi range is low, connectivity is not good (Cant blame dell, cos same issues with oth