Error: invalid method declaration;retrun type required

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siddartha

    Error: invalid method declaration;retrun type required

    If i compile the above code at line 8 invalid method declaration;ret run type required,

    How to solve it?

    Code:
    import java.awt.Frame;
    import java.awt.Label;
    public class Howdywindow extends Frame{
            public static void main(String arg[])
            {
                    new HowdyWindow();
            }
            HowdyWindow()
            {
                   Label label;
                   label = new Label("Howdy!");
                   add(label);
                   pack();
                   show();
             }
    }
  • pbrockway2
    Recognized Expert New Member
    • Nov 2007
    • 151

    #2
    It looks like the compiler thinks your constructor is a method (and hence needs a return type). Why would it think that? Hint: cAsE mAtTeRs.

    Comment

    • Dheeraj Joshi
      Recognized Expert Top Contributor
      • Jul 2009
      • 1129

      #3
      Your class name is
      Code:
      Howdywindow
      But your constructor is
      Code:
      HowdyWindow
      Constructor should have the same case as the class name.
      Please modify it.

      Regards
      Dheeraj Joshi

      Comment

      Working...