java error: constructor call must be the first statement in a constructor

后端 未结 4 1801
忘了有多久
忘了有多久 2021-01-22 17:37

The following code returns me an error saying:
\"constructor call must be the first statment in a constructor.\"

I dont get it. The constructor in my c

4条回答
  •  再見小時候
    2021-01-22 18:22

    The constructors name must be the same as the class name, so change either change the class name to labelFrame or the constructor name to labelsAndIcons.

    Example (note that usually the first letter is a capital letter in java):

    public class LabelFrame extends JFrame {
        public LabelFrame() {
            super( "Testing JLabel" );
        }
    }
    

提交回复
热议问题