Problem with JMenus

I have this code

import java.io.*;

import java.util.*;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

publicclass rCalc

{

//JFrame

JFrame mainFrame =new JFrame("Acidmods Resistance Calculator");

//JmenuBar

JMenuBar menuBar =new JMenuBar();

//JMenu

JMenu menu =new JMenu("Calculators");

menuBar.add(menu);

//Menu Items

JMenuItem resI =new JMenuItem("Resistence");

menu.add(resI);

//Main

publicstaticvoid main(String[] args)

{

}

}

but when i try to compile it i get these errors

<identifier> expectedline 18

<identifier> expectedline18

<identifier> expectedline22

<identifier> expectedline22

What is wrong with it?

[1643 byte] By [The_Undeada] at [2007-11-27 11:08:47]
# 1

menuBar.add(menu);

Instance(member) variables can be declared outside of code blocks(constructors, methods, static blocks). All other lines of code, like the example above, need to be inside a code block.

floundera at 2007-7-29 13:31:11 > top of Java-index,Java Essentials,New To Java...
# 2

Ahhh, thank you i cant beleive i didnt catch that, anyways thanks for your help. I gave you 10 stars :)

The_Undeada at 2007-7-29 13:31:11 > top of Java-index,Java Essentials,New To Java...