Results 1 to 3 of 3
- 01-29-2013, 06:57 AM #1
Member
- Join Date
- Nov 2012
- Posts
- 57
- Rep Power
- 0
Class, interface, or enum expected??
The following code is throwing back an annoying error at me that I thought I knew what it meant, but I am lost on this....

Please tell me what is happening here!!!!Java Code:package zlloyd1; import javax.swing.*; import java.awt.*; import java.awt.event.*; public static void class NewClass{ //Class, interface or enum expected right here???? private JFrame f = new JFrame(); private JTextField t1 = new JTextField(24); private JTextField t2 = new JTextField(24); private JTextArea t3 = new JTextArea(8, 16); private JButton b1 = new JButton("Write"); private JButton b2 = new JButton("Read"); private JButton b3 = new JButton("Clear"); private JButton b4 = new JButton("Exit"); static String one; public NewClass(){ f.add(new JLabel("Input")); f.add(t1); f.add(new JLabel("input2")); f.add(t2); f.add(new JLabel("Readout")); f.add(t3); //b1.addActionListener(this); f.add(b1); //b2.addActionListener(this); f.add(b2); //b3.addActionListener(this); f.add(b3); //b4.addActionListener(new ActionListener()); f.add(b4); f.setTitle("Input / Output Script"); f.setLocationRelativeTo(null); f.setSize(240, 240); f.setVisible(true); } public static void main(String[] args){ new NewClass(); } public void actionPerformed(ActionEvent ae) { throw new UnsupportedOperationException("Not supported yet."); } }
- 01-29-2013, 07:01 AM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: Class, interface, or enum expected??
Delete the static void! You are declaring a class! -> Declaring Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
- 01-29-2013, 09:13 PM #3
Member
- Join Date
- Nov 2012
- Posts
- 57
- Rep Power
- 0
Similar Threads
-
Help! i keep getting error: class, interface, or enum expected
By Azrael in forum New To JavaReplies: 3Last Post: 01-20-2013, 08:06 PM -
class, interface, or enum expected
By CrazyTofu999 in forum New To JavaReplies: 4Last Post: 01-12-2013, 08:31 PM -
Class Interface or enum expected
By ankiit in forum New To JavaReplies: 9Last Post: 12-22-2011, 09:10 AM -
keep getting error message class, interface, or enum expected
By darr in forum New To JavaReplies: 2Last Post: 10-02-2010, 02:13 AM -
class, interface or enum expected?
By Addez in forum New To JavaReplies: 2Last Post: 08-26-2009, 07:54 PM


LinkBack URL
About LinkBacks
Reply With Quote
I will set this to just public class NewClass, and see if that solves this, thanks!!

Bookmarks