Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jim Janney Newsgroups: comp.lang.java.programmer Subject: Re: It doesn't like 'super' where ever I put it. Date: Sun, 10 Jun 2012 08:02:06 -0600 Organization: he sent them word I had not gone Lines: 73 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="dZdavj/jUDynNQgDq5jkeA"; logging-data="20083"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vOKtu2SOZ1TlkqAbva1SV" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:fBiwfP31XtkK2IIbdVardc/ZW1k= sha1:X4rugnvrV8eL+6gEx7gpsVLLG6E= Xref: csiph.com comp.lang.java.programmer:15171 bilsch writes: > Hello, below is my program stripped to bare bones. Java says 'super' > must be first statement in constructor. I've moved it everywhere > still no luck. The program was running yesterday and I can't figure > what could be wrong. Any suggestions? > > The error output is listed below the program > > TIA Bill S. > > > PROGRAM: > > import javax.swing.*; > import java.awt.*; > import java.util.*; > > public class CalcFrame1 extends JFrame{ > > public void CalcFrame1() { > super("CalcFrame1"); > //setTitle("CalcFrame1"); > FlowLayout flo = new FlowLayout(); > setLayout(flo); > setLookAndFeel(); > //setSize(600,600); > > JButton shf = new JButton("shft"); > JButton chs = new JButton("chs"); > add (shf); > add (chs); > > pack(); > setVisible(true); > } > private void setLookAndFeel(){ > try{ > UIManager.setLookAndFeel( > "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); > } > catch(Exception exc){ > // ignore error > } > } > > public static void main(String[] args){ > CalcFrame1 ClFr1 = new CalcFrame1(); > } > } > > ERROR OUTPUT: > java.lang.VerifyError: Constructor must call super() or this() before > return in method CalcFrame1.()V at offset 0 > at java.lang.Class.getDeclaredMethods0(Native Method) > at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) > at java.lang.Class.getMethod0(Class.java:2685) > at java.lang.Class.getMethod(Class.java:1620) > at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:492) > at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:484) > Exception in thread "main" Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) Try changing public void CalcFrame1() { to public CalcFrame1() { -- Jim Janney