Interface or class expected

hi
public class TopLevelClass
     public void nonStaticMethod_1()
          System.out.println("nonstaticMethod_1 in AccessInTopLevelClass");
     private static class MemberClass_1{
     private static int i;
     private int j=10;
     public static void StaticMethod_1_1()
          System.out.println("nonstaticMethod_1_1 in StaticMemberClass_1");
     interface StaticMemberInterface1_1
public void display();
protected static class StaticMemberClass_1_1
implements StaticMemberInterface1_1
     private int k=99;
     public void display()
System.out.println("Hi ,i am in StaticMemberClass_1_1");
// interface StaticMemberInterface_1 extends StaticMemberClass_1.StaticMemberInterface_1
public void nonstaticmethod_1_1_1()
     int jj=j;
     int ii=i;
     // nonStaticMethod_1();//not ok
     StaticMethod_1_1();
public static void main(String arg[])
     int ii=1;
     //int kk=k;
     StaticMethod_1_1();
when i complie this program i have one errors
class or interface expected i don,t understand it can any body help me to remove this error and what is the cause of this error

amit4444 wrote:
so u mean i have to write psvm in toplevel class .*is their any other way to remove this exception*By programming in Cobol.

Similar Messages

  • Class, interface, or enum expected error

    import java.awt.Graphics;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class InventoryFinal
    //main method begins execution of java application
    public static void main(final String args[])
    int i; // varialbe for looping
    double total = 0; // variable for total inventory
    final int dispProd = 0; // variable for actionEvents
    // Instantiate a product object
    final ProductAdd[] nwProduct = new ProductAdd[5];
    // Instantiate objects for the array
    for (i=0; i<5; i++)
    nwProduct[0] = new ProductAdd("CD", 10, 18, 12.00, "Jewel Case");
    nwProduct[1] = new ProductAdd("Blue Ray", 9, 20, 25.00, "HD");
    nwProduct[2] = new ProductAdd("Game", 8, 30, 40.00, "Game Case");
    nwProduct[3] = new ProductAdd("iPod", 7, 40, 50.00, "Box");
    nwProduct[4] = new ProductAdd("DVD", 6, 15, 15.00, "DVD Case");
    for (i=0; i<5; i++)
    total += nwProduct.length; // calculate total inventory cost
    final JButton firstBtn = new JButton("First"); // first button
    final JButton prevBtn = new JButton("Previous"); // previous button
    final JButton nextBtn = new JButton("Next"); // next button
    final JButton lastBtn = new JButton("Last"); // last button
    final JButton AddBtn = new JButton("Add"); // Add button
    final JButton DeleteBtn = new JButton("Delete"); // Delete button
    final JButton ModifyBtn = new JButton("Modify"); // Modify button
    final JButton SaveBtn = new JButton("Save"); // Save button
    final JButton SearchBtn = new JButton("Search"); // Search button
    final JLabel label; // logo
    final JTextArea textArea; // text area for product list
    final JPanel buttonJPanel; // panel to hold buttons
    //JLabel constructor for logo
    Icon logo = new ImageIcon("C:/logo.jpg"); // load logo
    label = new JLabel(logo); // create logo label
    label.setToolTipText("Company Logo"); // create tooltip
    buttonJPanel = new MyJPanel(); // set up panel
    buttonJPanel.setLayout( new GridLayout(1, 4)); //set layout
    // add buttons to buttonPanel
    buttonJPanel.add(firstBtn);
    buttonJPanel.add(prevBtn);
    buttonJPanel.add(nextBtn);
    buttonJPanel.add(lastBtn);
    buttonJPanel.add(AddBtn);
    buttonJPanel.add(DeleteBtn);
    buttonJPanel.add(ModifyBtn);
    buttonJPanel.add(SaveBtn);
    buttonJPanel.add(SearchBtn);
    textArea = new JTextArea(nwProduct[3]+"\n"); // create textArea for product display
    // add total inventory value to GUI
    textArea.append("/nTotal value of Inventory "+new java.text.DecimalFormat("$0.00").format(total)+"\n\n");
    textArea.setEditable(false); // make text uneditable in main display
    JFrame invFrame = new JFrame(); // create JFrame container
    invFrame.setLayout(new BorderLayout()); // set layout
    invFrame.getContentPane().add(new JScrollPane(textArea), BorderLayout.CENTER); // add textArea to JFrame
    invFrame.getContentPane().add(buttonJPanel, BorderLayout.SOUTH); // add buttons to JFrame
    invFrame.getContentPane().add(label, BorderLayout.NORTH); // add logo to JFrame
    invFrame.setTitle("CD & DVD Inventory"); // set JFrame title
    invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // termination command
    //invFrame.pack();
    invFrame.setSize(600, 600); // set size of JPanel
    invFrame.setLocationRelativeTo(null); // set screen location
    invFrame.setVisible(true); // display window
    // assign actionListener and actionEvent for each button
    firstBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[0]+"\n");
    } // end firstBtn actionEvent
    }); // end firstBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    prevBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[4]+"\n");
    } // end prevBtn actionEvent
    }); // end prevBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    nextBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[2]+"\n");
    } // end nextBtn actionEvent
    }); // end nextBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    lastBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[3]+"\n");
    } // end lastBtn actionEvent
    }); // end lastBtn actionListener
    textArea.setText(nwProduct[4]+"n");// assign actionListener and actionEvent for each button
    AddBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[0]+"\n");
    } // end AddBtn actionEvent
    }); // end AddBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    // assign actionListener and actionEvent for each button
    DeleteBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[0]+"\n");
    } // end DeleteBtn actionEvent
    }); // end DeleteBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    // assign actionListener and actionEvent for each button
    ModifyBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[0]+"\n");
    } // end ModifyBtn actionEvent
    }); // end ModifyBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    // assign actionListener and actionEvent for each button
    SaveBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[0]+"\n");
    } // end SaveBtn actionEvent
    }); // end SaveBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    // assign actionListener and actionEvent for each button
    SearchBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    textArea.setText(nwProduct[0]+"\n");
    } // end SearchBtn actionEvent
    }); // end SearchBtn actionListener
    textArea.setText(nwProduct[4]+"n");
    // prevBtn.addActionListener(new ActionListener()
    // public void actionPerformed(ActionEvent ae)
    // dispProd = (nwProduct.length+dispProd-1) % nwProduct.length;
    // textArea.setText(nwProduct.display(dispProd)+"\n");
    // } // end prevBtn actionEvent
    // }); // end prevBtn actionListener
    } // end main
    } // end class Inventory4
    class Product
    protected String prodName; // name of product
    protected int itmNumber; // item number
    protected int units; // number of units
    protected double price; // price of each unit
    protected double value; // value of total units
    public Product(String name, int number, int unit, double each) // Constructor for class Product
    prodName = name;
    itmNumber = number;
    units = unit;
    price = each;
    } // end constructor
    public void setProdName(String name) // method to set product name
    prodName = name;
    public String getProdName() // method to get product name
    return prodName;
    public void setItmNumber(int number) // method to set item number
    itmNumber = number;
    public int getItmNumber() // method to get item number
    return itmNumber;
    public void setUnits(int unit) // method to set number of units
    units = unit;
    public int getUnits() // method to get number of units
    return units;
    public void setPrice(double each) // method to set price
    price = each;
    public double getPrice() // method to get price
    return price;
    public double calcValue() // method to set value
    return units * price;
    } // end class Product
    class ProductAdd extends Product
    private String feature; // variable for added feature
    public ProductAdd(String name, int number, int unit, double each, String addFeat)
    // call to superclass Product constructor
    super(name, number, unit, each);
    feature = addFeat;
    }// end constructor
    public void setFeature(String addFeat) // method to set added feature
    feature = addFeat;
    public String getFeature() // method to get added feature
    return feature;
    public double calcValueRstk() // method to set value and add restock fee
    return units * price * 0.10;
    public String toString()
    return String.format("Product: %s\nItem Number: %d\nIn Stock: %d\nPrice: $%.2f\nType: %s\nTotal Value of Stock: $%.2f\nRestock Cost: $%.2f\n\n",
    getProdName(), getItmNumber(), getUnits(), getPrice(), getFeature(), calcValue(), calcValueRstk());
    } // end class ProductAdd
    class MyJPanel extends JPanel
    //private static Random generator = new Random();
    private ImageIcon picture; //image to be displayed
    // load image
    public MyJPanel()
    picture = new ImageIcon("mypicture.png"); // set icon
    } // end MyJPanel constructor
    // display imageIcon on panel
    public void paintComponent( Graphics g )
    super.paintComponent( g );
    picture.paintIcon( this, g, 0, 0 ); // display icon
    } // end method paintComponent
    // return image dimensions
    //public Dimension getPreferredSize()
    // return new Dimension ( picture.getIconWidth(),
    //picture.getIconHeight() );
    } // end method getPreferredSize
    } // end class MyJPanel
    import java.io.File;
    import java.io.IOException;
    public class FileAccessDemo
    public static void main( String[] args ) throws IOException
    // declare variables
    String formatStr = "%s exists in %s? %b\n\n";
    // processing and output
    File file1 = new File( "studentScores.txt" ); // create a File object
    System.out.printf
    (formatStr, file1.getName(), file1.getAbsolutePath(), file1.exists());
    // processing and output
    File folder1 = new File( "c:/personnel/" ); // create a File object
    folder1.mkdir(); // make a directory
    File file2 = new File( "/personnel/faculty.txt" );
    file2.createNewFile(); // create a new file
    System.out.printf
    ( formatStr, file2.getName(), file2.getAbsolutePath(), file2.exists() );
    // processing and output
    file2.delete(); // delete a file, but not the directory
    System.out.printf
    ( formatStr, file2.getName(), file2.getAbsolutePath(), file2.exists() );
    } // end main
    } // end class
    I need help in resolving this error.
    Thanks

    That code isn't where your error is. Here's the errors I get compiling your code:
    H:\java>javac InventoryFinal.java
    InventoryFinal.java:78: ')' expected
    textArea.append("/nTotal value of Inventory "new java.text.DecimalFormat("$0.00").format(total)"\n\n
                                                 ^
    InventoryFinal.java:78: ';' expected
    textArea.append("/nTotal value of Inventory "new java.text.DecimalFormat("$0.00").format(total)"\n\n
                                                                                                   ^
    InventoryFinal.java:340: class, interface, or enum expected
    import java.io.File;
    ^
    InventoryFinal.java:341: class, interface, or enum expected
    import java.io.IOException;
    ^
    4 errorsThe last two errors are on your import statements, which can't be in the middle of a source file. The first two are on this line:
    textArea.append("/nTotal value of Inventory "new java.text.DecimalFormat("$0.00").format(total)"\n\n");Which certainly isn't a legal line of Java code. If you want to connect multiple Strings you need to use the "+" operator.

  • [Help] class, interface or enum expected

    I keep getting the error 'class, interface or enum expected'... help :S
    Here's my .java file
    >
    package net.sf.odinms.client.messages.commands;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.messages.CommandDefinition;
    import net.sf.odinms.client.messages.Command;
    import net.sf.odinms.client.messages.IllegalCommandSyntaxException;
    import net.sf.odinms.client.messages.MessageCallback;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.client.MapleJob;
    import net.sf.odinms.client.MapleStat;
    import net.sf.odinms.client.SkillFactory;
    import net.sf.odinms.net.channel.ChannelServer;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.tools.StringUtil;
    import net.sf.odinms.tools.data.output.MaplePacketLittleEndianWriter;
    import static net.sf.odinms.client.messages.CommandProcessor.getOptionalIntArg;
    public class customCommands implements Command {
         @Override
         public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception,
                                                                                                             IllegalCommandSyntaxException {
    if (splitted[0].equals("!spy")) {
    double var;double var2;int str; int dex;int intel; int luk; int meso; int maxhp; int maxmp;
    ChannelServer cserv = c.getChannelServer();
    MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    var = victim.getJumpMod(); var2 = victim.getSpeedMod(); str = victim.getStr(); dex = victim.getDex(); intel = victim.getInt(); luk = victim.getLuk(); meso = victim.getMeso(); maxhp = victim.getCurrentMaxHp();maxmp = victim.getCurrentMaxMp();
    mc.dropMessage("JumpMod is" + var + " and Speedmod is" + var2+ "!");
    mc.dropMessage("Players stats are:");
    mc.dropMessage(" Str: "+ str+", Dex: "+ dex+ ", Int: " + intel + ", Luk: "+ luk +" .");
    mc.dropMessage("Player has "+ meso + "mesos.");
    mc.dropMessage("Max hp is" + maxhp + " Max mp is" + maxmp + ".");
    } else if (splitted[0].equals("!maxall")) {
    int max = Integer.parseInt(splitted[1]);
    MapleCharacter player = c.getPlayer();
    player.setStr(max);
    player.setDex(max);
    player.setInt(max);
    player.setLuk(max);
                   player.setMaxMp(max);
    player.setMaxHp(max);               
    player.updateSingleStat(MapleStat.STR, player.getStr());
    player.updateSingleStat(MapleStat.DEX, player.getStr());
    player.updateSingleStat(MapleStat.INT, player.getStr());
    player.updateSingleStat(MapleStat.LUK, player.getStr());
    player.updateSingleStat(MapleStat.MAXHP, player.getStr());
                   player.updateSingleStat(MapleStat.MAXMP, player.getStr());
    } else if (splitted[0].equals("!giftnx")) {
    ChannelServer cserv = c.getChannelServer();
    MapleCharacter victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    int points = Integer.parseInt(splitted[2]);
         victim1.modifyCSPoints(0, points);
    mc.dropMessage("NX cash has been gifted.");
    }     else if (splitted[0].equals("!fame")) {
    ChannelServer cserv = c.getChannelServer();
    MapleCharacter player = c.getPlayer();
    MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    int fame = Integer.parseInt(splitted[2]);
    victim.setFame(fame);
    player.updateSingleStat(MapleStat.FAME, fame);
              }     else if (splitted[0].equals("!hide")) {
    ChannelServer cserv = c.getChannelServer();
    MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    if (victim != null) {
    int skill = Integer.parseInt("5101004");
    int level = Integer.parseInt("1");
    SkillFactory.getSkill(skill).getEffect(level).applyTo(victim); }
    continued next post
    Edited by: xQuasar on Sep 26, 2008 7:33 PM

    } else if (splitted[0].equals("!heal")) {
    MapleCharacter player = c.getPlayer();
                   player.setHp(player.getMaxHp());
                   player.updateSingleStat(MapleStat.HP, player.getMaxHp());
                   player.setMp(player.getMaxMp());
                   player.updateSingleStat(MapleStat.MP, player.getMaxMp());
    } else if (splitted[0].equals("!kill")) {
    ChannelServer cserv = c.getChannelServer();
    MapleCharacter victim1 = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    victim1.setHp(0);
    victim1.setMp(0);
    victim1.updateSingleStat(MapleStat.HP, 0);
    victim1.updateSingleStat(MapleStat.MP, 0);
    MapleCharacter victim2 = cserv.getPlayerStorage().getCharacterByName(splitted[2]);
    victim2.setHp(0);
    victim2.setMp(0);
    victim2.updateSingleStat(MapleStat.HP, 0);
    victim2.updateSingleStat(MapleStat.MP, 0);
    MapleCharacter victim3 = cserv.getPlayerStorage().getCharacterByName(splitted[3]);
    victim3.setHp(0);
    victim3.setMp(0);
    victim3.updateSingleStat(MapleStat.HP, 0);
    victim3.updateSingleStat(MapleStat.MP, 0);
    MapleCharacter victim4 = cserv.getPlayerStorage().getCharacterByName(splitted[4]);
    victim4.setHp(0);
    victim4.setMp(0);
    victim4.updateSingleStat(MapleStat.HP, 0);
    victim4.updateSingleStat(MapleStat.MP, 0);
    MapleCharacter victim5 = cserv.getPlayerStorage().getCharacterByName(splitted[5]);
    victim5.setHp(0);
    victim5.setMp(0);
    victim5.updateSingleStat(MapleStat.HP, 0);
    victim5.updateSingleStat(MapleStat.MP, 0);
    MapleCharacter victim6 = cserv.getPlayerStorage().getCharacterByName(splitted[6]);
    victim6.setHp(0);
    victim6.setMp(0);
    victim6.updateSingleStat(MapleStat.HP, 0);
    victim6.updateSingleStat(MapleStat.MP, 0);
    //for (MapleCharacter chr : c.getPlayer().getMap().getCharacters()) {
    } else if (splitted[0].equals("!dcall")) {
    ChannelServer cserv = c.getChannelServer();
                   for (MapleCharacter mch : cserv.getPlayerStorage().getAllCharacters()){
                        mch.getClient().getSession().close();
                             mch.getClient().disconnect();
    @Override
                   new CommandDefinition("spy", "", "", 1000),
    new CommandDefinition("maxall", "", "", 1000),
    new CommandDefinition("giftnx", "", "", 1000),
    new CommandDefinition("fame", "", "", 1000),
    new CommandDefinition("hide", "", "", 1000),
    new CommandDefinition("heal", "", "", 1000),
    new CommandDefinition("kill", "", "", 1000),
    new CommandDefinition("dcall", "", "", 1000),
    And my Netbeans is showing;
    >
    init:
    deps-jar:
    Compiling 356 source files to C:\Documents and Settings\Michael Su\Desktop\FlowsionMSClean\build\classes
    C:\Documents and Settings\Michael Su\Desktop\FlowsionMSClean\trunk\src\net\sf\odinms\client\messages\commands\customCommands.java:148: class, interface, or enum expected
    new CommandDefinition("spy", "", "", 1000),
    ^
    1 error
    BUILD FAILED (total time: 2 seconds)
    Help?

  • Class, interface, or enum expected?

    Ok I keep getting that error. Here is my java file that it is in.
    package server.main.project12.skills;
    import java.io.*;
    import server.main.project12.*;
    public class fireMaking {
    public int xpgained = 1;//Change this and the fire xp will be times by that, so 40 time 1 = 40, 40
    times 100 = 4000.
        public void WalkTo(int x, int y) { 
            newWalkCmdSteps = (Math.abs((x+y)));
            if(newWalkCmdSteps % 1 != 0)
                newWalkCmdSteps /= 1;
            if(++newWalkCmdSteps > walkingQueueSize) {
                println("Warning: WalkTo("+packetType+") command contains too many steps
    ("+newWalkCmdSteps+").");
                newWalkCmdSteps = 0;
            int firstStepX = absX;
            int tmpFSX = firstStepX;
            firstStepX -= mapRegionX*8;
            for(i = 1; i < newWalkCmdSteps; i++) {
                newWalkCmdX[i] = x;
                newWalkCmdY[i] = y;
                tmpNWCX[i] = newWalkCmdX;
    tmpNWCY[i] = newWalkCmdY[i];
    newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0;
    int firstStepY = absY;
    int tmpFSY = firstStepY;
    firstStepY -= mapRegionY*8;
    newWalkCmdIsRunning = ((inStream.readSignedByteC() == 1) && playerEnergy > 0);
    for(i = 0; i < newWalkCmdSteps; i++) {
    newWalkCmdX[i] += firstStepX;
    newWalkCmdY[i] += firstStepY;
    public int firetimer = 0;
    public int firetimers = 0;
    public int firetimers1 = 0;
    public int firetimers2 = 0;
    public int firetimers3 = 0;
    public int firetimers4 = 0;
    public int firetimers5 = 0;
    public int firetimers6 = 0;
    public int firetimers7 = 0;
    public int firetimers8 = 0;
    public int firetimers9 = 0;
    public int firetimers10 = 0;
    public int firetimers11 = 0;
    public int firetimers12 = 0;
    public int firetimers13 = 0;
    public int firetimers14 = 0;
    public int firetimers15 = 0;
    public int firetimers16 = 0;
    public int firetimers17 = 0;
    public int firetimers18 = 0;
    public int firetimers19 = 0;
    public int previousX = 0;
    public int previousY = 0;
    public int previousX1 = 0;
    public int previousY1 = 0;
    public int previousX2 = 0;
    public int previousY2 = 0;
    public int previousX3 = 0;
    public int previousY3 = 0;
    public int previousX4 = 0;
    public int previousY4 = 0;
    public int previousX5 = 0;
    public int previousY5 = 0;
    public int previousX6 = 0;
    public int previousY6 = 0;
    public int previousX7 = 0;
    public int previousY7 = 0;
    public int previousX8 = 0;
    public int previousY8 = 0;
    public int previousX9 = 0;
    public int previousY9 = 0;
    public int previousX10 = 0;
    public int previousY10 = 0;
    public int previousX11 = 0;
    public int previousY11 = 0;
    public int previousX12 = 0;
    public int previousY12 = 0;
    public int previousX13 = 0;
    public int previousY13 = 0;
    public int previousX14 = 0;
    public int previousY14 = 0;
    public int previousX15 = 0;
    public int previousY15 = 0;
    public int previousX16 = 0;
    public int previousY16 = 0;
    public int previousX17 = 0;
    public int previousY17 = 0;
    public int previousX18 = 0;
    public int previousY18 = 0;
    public int previousX19 = 0;
    public int previousY19 = 0;
    public int logID = 0;
    public boolean process() {
    //FIRE MAKING TIMERS
    if(firetimer > 0)
    firetimer -= 1;
    if(firetimers > 0)
    firetimers -= 1;
    if(firetimers1 > 0)
    firetimers1 -= 1;
    if(firetimers3 > 0)
    firetimers3 -= 1;
    if(firetimers2 > 0)
    firetimers2 -= 1;
    if(firetimers4 > 0)
    firetimers4 -= 1;
    if(firetimers5 > 0)
    firetimers5 -= 1;
    if(firetimers6 > 0)
    firetimers6 -= 1;
    if(firetimers7 > 0)
    firetimers7 -= 1;
    if(firetimers8 > 0)
    firetimers8 -= 1;
    if(firetimers9 > 0)
    firetimers9 -= 1;
    if(firetimers10 > 0)
    firetimers10 -= 1;
    if(firetimers11 > 0)
    firetimers11 -= 1;
    if(firetimers13 > 0)
    firetimers13 -= 1;
    if(firetimers12 > 0)
    firetimers12 -= 1;
    if(firetimers14 > 0)
    firetimers14 -= 1;
    if(firetimers15 > 0)
    firetimers15 -= 1;
    if(firetimers16 > 0)
    firetimers16 -= 1;
    if(firetimers17 > 0)
    firetimers17 -= 1;
    if(firetimers18 > 0)
    firetimers18 -= 1;
    if(firetimers19 > 0)
    firetimers19 -= 1;
    if(firetimers == 1)
    ItemHandler.addItem(592, previousX, previousY, 1, playerId, false);
    ReplaceObject2(previousX, previousY, 6951, 0, 10);
    previousX = 0;
    previousY = 0;
    if(firetimers1 == 1)
    ItemHandler.addItem(592, previousX1, previousY1, 1, playerId, false);
    ReplaceObject2(previousX1, previousY1, 6951, 0, 10);
    previousX1 = 0;
    previousY1 = 0;
    if(firetimers2 == 1)
    ItemHandler.addItem(592, previousX2, previousY1, 1, playerId, false);
    ReplaceObject2(previousX2, previousY2, 6951, 0, 10);
    previousX2 = 0;
    previousY2 = 0;
    if(firetimers3 == 1)
    ItemHandler.addItem(592, previousX3, previousY3, 1, playerId, false);
    ReplaceObject2(previousX3, previousY3, 6951, 0, 10);
    previousX3 = 0;
    previousY3 = 0;
    if(firetimers4 == 1)
    ItemHandler.addItem(592, previousX4, previousY4, 1, playerId, false);
    ReplaceObject2(previousX4, previousY4, 6951, 0, 10);
    previousX4 = 0;
    previousY4 = 0;
    if(firetimers5 == 1)
    ItemHandler.addItem(592, previousX5, previousY5, 1, playerId, false);
    ReplaceObject2(previousX5, previousY5, 6951, 0, 10);
    previousX5 = 0;
    previousY5 = 0;
    if(firetimers9 == 1)
    ItemHandler.addItem(592, previousX9, previousY9, 1, playerId, false);
    ReplaceObject2(previousX9, previousY9, 6951, 0, 10);
    previousX9 = 0;
    previousY9 = 0;
    if(firetimers8 == 1)
    ItemHandler.addItem(592, previousX8, previousY8, 1, playerId, false);
    ReplaceObject2(previousX8, previousY8, 6951, 0, 10);
    previousX8 = 0;
    previousY8 = 0;
    if(firetimers7 == 1)
    ItemHandler.addItem(592, previousX7, previousY7, 1, playerId, false);
    ReplaceObject2(previousX7, previousY7, 6951, 0, 10);
    previousX7 = 0;
    previousY7 = 0;
    if(firetimers6 == 1)
    ItemHandler.addItem(592, previousX6, previousY6, 1, playerId, false);
    ReplaceObject2(previousX6, previousY6, 6951, 0, 10);
    previousX6 = 0;
    previousY6 = 0;
    if(firetimers10== 1)
    ItemHandler.addItem(592, previousX10, previousY10, 1, playerId, false);
    ReplaceObject2(previousX10, previousY10, 6951, 0, 10);
    previousX10 = 0;
    previousY10 = 0;
    if(firetimers11 == 1)
    ItemHandler.addItem(592, previousX11, previousY11, 1, playerId, false);
    ReplaceObject2(previousX11, previousY11, 6951, 0, 10);
    previousX11 = 0;
    previousY11 = 0;
    if(firetimers12 == 1)
    ItemHandler.addItem(592, previousX12, previousY12, 1, playerId, false);
    ReplaceObject2(previousX12, previousY12, 6951, 0, 10);
    previousX12 = 0;
    previousY12 = 0;
    if(firetimers13 == 1)
    ItemHandler.addItem(592, previousX13, previousY13, 1, playerId, false);
    ReplaceObject2(previousX13, previousY13, 6951, 0, 10);
    previousX13 = 0;
    previousY13 = 0;
    if(firetimers14 == 1)
    ItemHandler.addItem(592, previousX14, previousY14, 1, playerId, false);
    ReplaceObject2(previousX14, previousY14, 6951, 0, 10);
    previousX14 = 0;
    previousY14 = 0;
    if(firetimers15 == 1)
    ItemHandler.addItem(592, previousX15, previousY15, 1, playerId, false);
    ReplaceObject2(previousX15, previousY15, 6951, 0, 10);
    previousX15 = 0;
    previousY15 = 0;
    if(firetimers19 == 1)
    ItemHandler.addItem(592, previousX19, previousY19, 1, playerId, false);
    ReplaceObject2(previousX19, previousY19, 6951, 0, 10);
    previousX19 = 0;
    previousY19 = 0;
    if(firetimers18 == 1)
    ItemHandler.addItem(592, previousX18, previousY18, 1, playerId, false);
    ReplaceObject2(previousX18, previousY18, 6951, 0, 10);
    previousX18 = 0;
    previousY18 = 0;
    if(firetimers17 == 1)
    ItemHandler.addItem(592, previousX17, previousY17, 1, playerId, false);
    ReplaceObject2(previousX17, previousY17, 6951, 0, 10);
    previousX17 = 0;
    previousY17 = 0;
    if(firetimers16 == 1)
    ItemHandler.addItem(592, previousX16, previousY16, 1, playerId, false);
    ReplaceObject2(previousX16, previousY16, 6951, 0, 10);
    previousX16 = 0;
    previousY16 = 0;
    if(firetimer == 1)
    if(logID == 1)
    addSkillXP((40*xpgained), 11);
    removeGroundItem(absX, absY, 1511);
    logID = 0;
    if(logID == 2)
    addSkillXP((60*xpgained), 11);
    removeGroundItem(absX, absY, 1521);
    logID = 0;
    if(logID == 3)
    addSkillXP((90*xpgained), 11);
    removeGroundItem(absX, absY, 1519);
    logID = 0;
    if(logID == 4)
    addSkillXP((135*xpgained), 11);
    removeGroundItem(absX, absY, 1517);
    logID = 0;
    if(logID == 5)
    addSkillXP((202*xpgained), 11);
    removeGroundItem(absX, absY, 1515);
    logID = 0;
    if(logID == 6)
    addSkillXP((303*xpgained), 11);
    removeGroundItem(absX, absY, 1513);
    logID = 0;
    WalkTo(-1, 0);
    sendMessage("The fire catches, and the logs begin to burn.");
    Object(absX, absY, 2732, 0, 10);
    firetimer = 0;
    updateRequired = true;
    appearanceUpdateRequired = true;
    if(previousX == 0 && previousY == 0)
    previousX = absX;
    previousY = absY;
    firetimers = 60; //DO NOT CHANGE THIS
    viewTo(previousX, previousY);
    else
    if(previousX1 == 0 && previousY1 == 0)
    previousX1 = absX;
    previousY1 = absY;
    firetimers1 = 60;
    viewTo(previousX1, previousY1);
    else
    if(previousX2 == 0 && previousY2 == 0)
    previousX2 = absX;
    previousY2 = absY;
    firetimers2 = 60;
    viewTo(previousX2, previousY2);
    else
    if(previousX3 == 0 && previousY3 == 0)
    previousX3 = absX;
    previousY3 = absY;
    firetimers3 = 60;
    viewTo(previousX3, previousY3);
    else
    if(previousX4 == 0 && previousY4 == 0)
    previousX4 = absX;
    previousY4 = absY;
    firetimers4 = 60;
    viewTo(previousX4, previousY4);
    else
    if(previousX5 == 0 && previousY5 == 0)
    previousX5 = absX;
    previousY5 = absY;
    firetimers5 = 60;
    viewTo(previousX5, previousY5);
    else
    if(previousX6 == 0 && previousY6 == 0)
    previousX6 = absX;
    previousY6 = absY;
    firetimers6 = 60;
    viewTo(previousX6, previousY6);
    else
    if(previousX7 == 0 && previousY7 == 0)
    previousX7 = absX;
    previousY7 = absY;
    firetimers7 = 60;
    viewTo(previousX7, previousY7);
    else
    if(previousX8 == 0 && previousY8 == 0)
    previousX8 = absX;
    previousY8 = absY;
    firetimers8 = 60;
    viewTo(previousX8, previousY8);
    else
    if(previousX9 == 0 && previousY9 == 0)
    previousX9 = absX;
    previousY9 = absY;
    firetimers9 = 60;
    viewTo(previousX9, previousY9);
    else
    if(previousX10 == 0 && previousY10 == 0)
    previousX10 = absX;
    previousY10 = absY;
    firetimers10 = 60;
    viewTo(previousX10, previousY10);
    else
    if(previousX11 == 0 && previousY11 == 0)
    previousX11 = absX;
    previousY11 = absY;
    firetimers11 = 60;
    viewTo(previousX11, previousY11);
    else
    if(previousX12 == 0 && previousY12 == 0)
    previousX12 = absX;
    previousY12 = absY;
    firetimers12 = 60;
    viewTo(previousX12, previousY12);
    else
    if(previousX13 == 0 && previousY13 == 0)
    previousX13 = absX;
    previousY13 = absY;
    firetimers13 = 60;
    viewTo(previousX13, previousY13);
    else
    if(previousX14 == 0 && previousY14 == 0)
    previousX14 = absX;
    previousY14 = absY;
    firetimers14 = 60;
    viewTo(previousX14, previousY14);
    else
    if(previousX15 == 0 && previousY15 == 0)
    previousX15 = absX;
    previousY15 = absY;
    firetimers15 = 60;
    viewTo(previousX15, previousY15);
    else
    if(previousX16 == 0 && previousY16 == 0)
    previousX16 = absX;
    previousY16 = absY;
    firetimers16 = 60;
    viewTo(previousX16, previousY16);
    else
    if(previousX17 == 0 && previousY17 == 0)
    previousX17 = absX;
    previousY17 = absY;
    firetimers17 = 60;
    viewTo(previousX17, previousY17);
    else
    if(previousX18 == 0 && previousY18 == 0)
    previousX18 = absX;
    previousY18 = absY;
    firetimers18 = 60;
    viewTo(previousX18, previousY18);
    else
    if(previousX19 == 0 && previousY19 == 0)
    previousX19 = absX;
    previousY19 = absY;
    firetimers19 = 60;
    viewTo(previousX19, previousY19);
    }And this is what my compiler is showing.C:\Users\Matthew\Documents\server.main.project12>javac *.java
    Note: stream.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    C:\Users\Matthew\Documents\server.main.project12>javac ./skills/*.java
    .\skills\firemaking.java:594: class, interface, or enum expected
    ^
    1 error
    C:\Users\Matthew\Documents\server.main.project12>pause
    Press any key to continue . . .I really need help with this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    This error is often caused by improper matching of braces { }.
    Solution: Check the matching opening and closing braces.
    Worse, the error could be totally invisible! Often, it is the first thing in the file, before package or import declarations
    In that situation, it could be caused by a code edited / formatted using a text editor not designed for programming such as Word, which introduces invisible characters in the code.
    Solution : In that case, cut and paste the code in a true code editor as Eclipse or NotePad which withdrawing the offending characters.
    This error occurs most often in the console (command line), almost never in an IDE.

  • Class, interface, or emun expected.

    When I compile to code I get 60 "class, interface, or emun expected errors. I know that this error usual means that there is a bracket out of place or missing. I went through and add line comments that link the opening and closing brackets together. Can anyone take a look and let me know what I am missing. Thanks.
    {code}
    // Inventory4.java
    // Program will track total inventory items in stock.
    import java.io.*;
    import javax.swing.JFrame;
    public class Inventory4
    {//1
    public class Item
    {//2
    private double unitPrice;
    private double quantityStock;
    private double inventoryValue;
    private double totalInventory;
    private int itemNumber;
    private String itemName;
    /** Create a new instance of Item Name */
    public Item(double UnitPrice,double QuantityStock,int      ItemNumber,String ItemName)
    {//3
    itemName = ItemName;
    itemNumber = itemNumber;
    unitPrice = UnitPrice;
    quantityStock = QuantityStock;
    }//3
    public void setItemName(String ItemName)
    {//4
    itemName = ItemName;
    }//4
    public void setItemNumber(int ItemNumber)
    {//5
    itemNumber = ItemNumber;
    }//5
    public void setUnitPrice(String InventoryHardware)
    {//6
    inventoryHardware=InventoryHardware;
    }//6
    public void setUnitPrice(double UnitPrice)
    {//7
    unitPrice = UnitPrice;
    }//7
    public void setQuantityStock(double QuantityStock)
    {//8
    quantityStock = QuantityStock;
    }//8
    public String getItemName()
    {//9
    return itemName;
    }//9
    public int getItemNumber()
    {//10
    return itemNumber;
    }//10
                        public String getInvetoryHardware()
    {//11
                        return inventoryHardware;
    }//11
    public double getUnitPrice()
    {//12
    return unitPrice;
    }//12
    public double getQuantityStock()
    {//13
    return quantityStock;
    }//13
    public String getInventoryHardware()
    {//14
    return inventoryHardware;
    }//14
    public double computeinventoryValue()
    {//15
    return quantityStock * unitPrice;
    }//15
    public double computetotalInventory()
    {//16
    return totalInventory = totalInventory + inventoryValue;
    }//16
    public String toString()
    {//17
    return (itemName);
    }//17
    }//2
    }//1
    // SubItem.java
    // Sub class to main program
    public class SubItem extends Item
    {//18
    private String inventoryHardware;
    private double restockingFee = .05;
    public SubItem(double UnitPrice,double QuantityStock,int InventoryWriteoffs,int
    ItemNumber,String ItemName)
    {//19
    setUnitPrice(UnitPrice);
    setQuantityStock(QuantityStock);
    setItemNumber(ItemNumber);
    setItemName(ItemName);
    inventoryWriteoffs = InventoryWriteoffs;
    }//19
    public void setInventoryHardware(String InventoryHardware)
    {//20
    inventoryHardware = InventoryHardware;
    }//20
    public int getInventoryHardware()
    {//21
    return inventoryWriteoffs;
    }//21
    public double computeRestockingFee()
    {//22
    return ((getUnitPrice() * getQuantityStock()) * restockingFee);
    }//22
    }//18
    private static BufferedReader stdin = new BufferedReader( new InputStreamReader(      System.in ) );
    private static int totalCount = 5;
    public Inventory4()
    {//23
    double unitPrice; // Unit price of each item
    double quantityStock; // Number of items in stock
    double inventoryValue; // Place holder for calculated inventory value
    double totalInventory; // Place holder for calculated total inventory value
    int itemNumber; // Item Number
    String itemName = ""; // Name of each item
    }//23
    public static void main(String[] args)throws IOException
    {//24
    SubItem myItem[];
    myItem = new SubItem[5];
    myItem[0] = new SubItem(10.35,20,4,1,"Traxx");
    myItem[1] = new SubItem(176.34,10,5,2,"Panels");
    myItem[2] = new SubItem(85.34,4,4,3,"Surfaces");
    myItem[3] = new SubItem(1.95,56,6,4,"Brackets");
    myItem[4] = new SubItem(82.34,8,1,5,"Overheads");
    printArray(myItem);
    myItem = sortArray(myItem);
    System.out.println(" Inventory List Sorted by Items \n\n");
    printArray(myItem);
    ItemButton itemButton = new ItemButton(myItem,totalCount); // Make ItemButton
    itemButton.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    itemButton.setSize( 350,390 ); // Window size
    itemButton.setVisible( true ); // display window
    } //24 End Main Method
    private static SubItem[] printArray(SubItem[] myItem)
    {//25
    double totalInventory = 0;
    double restockingFee = 0;
    for (int i = 0; i<5;++i)
    {//26
    System.out.println("\n The Item Number is " + i + myItem.getItemNumber() );
    System.out.println("\n Item Name is " + myItem.getItemName() );
    System.out.println("\n Quantity in Stock is " + myItem.getQuantityStock() );
    System.out.println("\n Inventory Write-off is " +      myItem.getInventoryWriteoffs() );
    System.out.println("\n Inventory Value is $" + myItem.computeinventoryValue               ());
    totalInventory = totalInventory + myItem.computeinventoryValue();
    restockingFee = totalInventory + myItem.computeRestockingFee();
    } //26 End For Loop
    System.out.println("\n Total Value of all inventory is " + totalInventory);
    System.out.println("\n Total Value of all inventory with restock fee $" +      restockingFee);
    return myItem;
    }//25
    private static SubItem[] sortArray(SubItem[] myItem)
    {//27
    SubItem temp = new SubItem();
    int i, j;
    int array_size = 5;
    for (i = (array_size - 1); i >= 0; i--)
    {//28
    for (j = 1; j <= i; j++)
    {//29
    if (myItem[j-1].getItemName().compareTo(myItem[j].getItemName()) > 1)
    {//30
    temp = myItem[j-1];
    myItem[j-1] = myItem[j];
    myItem[j] = temp;
    } //30 End if
    } //29 End inner for loop
    } //28 End outer for loop
    return myItem;
    } //27 End Method
    // ItemButton.java
    // This will create GUI buttons.
    // Display the Items.
    import java.awt.FlowLayout;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JFrame;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JOptionPane;
    import javax.swing.SwingConstants;
    public class ItemButton extends JFrame
    {//31
    private JButton nextJButton; // text button
    private JButton prevJButton; // icon button
    private JLabel lblItemName; // text field with set size
    private JTextField txtItemName; // text field constructed with text
    private JTextField textField3; // text field with text and size
    private JLabel lblItemNumber; // text field with set size
    private JTextField txtItemNumber; // text field constructed with text
    private JLabel lblUnitPrice; // text field with set size
    private JTextField txtUnitPrice; // text field constructed with text
    private JLabel lblQuantityStock; // text field with set size
    private JTextField txtQuantityStock; // text field constructed with text
    private JLabel lblInventoryWriteoffs; // text field with set size
    private JTextField txtInventoryWriteoffs; // text field constructed with text
    private JLabel lblcomputeRestockingFee; // text field with set size
    private JTextField txtcomputeRestockingFee; // text field constructed with text
    private JLabel lblcomputeinventoryValue; // text field with set size
    private JTextField txtcomputeinventoryValue; // text field constructed with text
    private JLabel lblcomputetotalInventory; // text field with set size
    private JTextField txtcomputetotalInventory; // text field constructed with text
    SubItem[] arraySubItem;
    private int currentArrayCounter;
    private int arrayCount;
    public ItemButton(SubItem[] myItem, int totalArrayCount)
    {//32
    super ( "Inventory" );
    arraySubItem = myItem;
    arrayCount = totalArrayCount;
    currentArrayCounter = 0;
    setLayout( new FlowLayout() ); // set frame layout
    Icon iconNext = new ImageIcon( getClass().getResource( "" ) );
    Icon iconPrev = new ImageIcon( getClass().getResource( "" ) );
    lblItemName = new JLabel( "Item Name ");
    add( lblItemName ); // textField3 to JFrame
    txtItemName = new JTextField( "", 15 );
    add( txtItemName ); // add textField3 to JFrame
    lblItemNumber = new JLabel( "Item Number ");
    add( lblItemNumber ); // textField3 to JFrame
    txtItemNumber = new JTextField( "", 15 );
    add( txtItemNumber ); // add textField3 to JFrame
    lblUnitPrice = new JLabel( "Unit Price ");
    add( lblUnitPrice ); // textField3 to JFrame
    txtUnitPrice = new JTextField( "", 15 );
    add( txtUnitPrice ); // add textField3 to JFrame
    lblQuantityStock = new JLabel( "Quantity Stock " );
    add( lblQuantityStock ); // textField3 to JFrame
    txtQuantityStock = new JTextField( "", 15 );
    add( txtQuantityStock ); // add textField3 to JFrame
    lblInventoryHardware = new JLabel( "Inventory Hardware " );
    add( lblInventoryHardware ); // textField3 to JFrame
              txtInventoryHardware = new JTextField( "", 15 );
    add( txtInventoryHardware ); // add textField3 to JFrame
    lblcomputeRestockingFee = new JLabel( "Restocking Fee ");
    add( lblcomputeRestockingFee ); // textField3 to JFrame
    txtcomputeRestockingFee = new JTextField( "", 15 );
    add( txtcomputeRestockingFee ); // add textField3 to JFrame
    lblcomputeinventoryValue = new JLabel( "Inventory Value " );
    add( lblcomputeinventoryValue ); // textField3 to JFrame
    txtcomputeinventoryValue = new JTextField( "", 15 );
    add( txtcomputeinventoryValue ); // add textField3 to JFrame
    lblcomputetotalInventory = new JLabel( "Total Inventory ");
    add( lblcomputetotalInventory ); // textField3 to JFrame
    txtcomputetotalInventory = new JTextField( "", 15 );
    add( txtcomputetotalInventory ); // add textField3 to JFrame
                   nextJButton = new JButton( "Next" ); // button with Next
                   prevJButton = new JButton( "Previous"); // button with Prev
                   add(prevJButton);
                   add(nextJButton); // add plainJButton to JFrame
                   ButtonHandler handler = new ButtonHandler();
    nextJButton.addActionListener( handler );
    prevJButton.addActionListener( handler );
    setTextFields();
    } //32 End ButtonFrame constructor
    private class ButtonHandler implements ActionListener
    {//33
    public void actionPerformed( ActionEvent event )
    {//34
    if (event.getActionCommand()== "prevJButton")
    {//35
    currentArrayCounter++;
    }//35
    else
    {//36
    currentArrayCounter++;
    }//36
    setTextFields();
    } //34 End Method ActionPerformed
    } //33 End Private inner class ButtonHandler
    private void setTextFields()
    {//37
    if (currentArrayCounter == arrayCount)
    {//38
    currentArrayCounter = 0;
    }//38
    if (currentArrayCounter < 0)
    {//39
    currentArrayCounter = arrayCount;
    }//39
    txtItemName.setText(arraySubItem[currentArrayCounter].getItemName());
    txtItemNumber.setText(arraySubItem[currentArrayCounter].getItemNumber()      +"");
    txtUnitPrice.setText(arraySubItem[currentArrayCounter].getUnitPrice()+"");
    txtQuantityStock.setText(arraySubItem[currentArrayCounter].getQuantityStock      ()+"");
    txtInventoryWriteoffs.setText(arraySubItem      [currentArrayCounter].getInventoryWriteoffs()+"");
    txtcomputeRestockingFee.setText(arraySubItem      [currentArrayCounter].computeRestockingFee()+"");
    txtcomputeinventoryValue.setText(arraySubItem     [currentArrayCounter].computeinventoryValue()+"");
    txtcomputetotalInventory.setText(arraySubItem      [currentArrayCounter].computetotalInventory()+"");
    }//37
    } //31 End class ItemButton
    {code}

    I have eliminated most of the problems, but I am still getting 11 Class interface or emun errors.
    It says the first error is in the lines that import the GUI buttons
    // Inventory4.java
    // Program will track total inventory items in stock.
    import java.io.*;
    import javax.swing.JFrame;
    public class Inventory4
    {//1
       public static void main (String [] args)  ;
         {//40
           class Item
           {//2
             private double unitPrice;
             private double quantityStock;
             private double inventoryValue;
             private double totalInventory;
             private int itemNumber;
             private String itemName;
                          /** Create a new instance of Item Name */
                       public Item(double UnitPrice,double QuantityStock,int                                                
                                  ItemNumber,String ItemName)
                                              {//3
                                                 itemName = ItemName;
                                                 itemNumber = itemNumber;
                                                 unitPrice = UnitPrice;
                                                quantityStock = QuantityStock;
                                                }//3
                                                           public void setItemName(String ItemName)
                                                          {//4
                                                        itemName = ItemName;
                                                            }//4
                                                           public void setItemNumber(int ItemNumber)
                                                            {//5
                                                       itemNumber = ItemNumber;
                                                             }//5
                                                          public void setUnitPrice(String InventoryHardware)
                                                                   {//6
                                                                 inventoryHardware=InventoryHardware;
                                                                    }//6
                                                          public void setUnitPrice(double UnitPrice)
                                                                    {//7
                                                      unitPrice = UnitPrice;
                                                                     }//7
                                                          public void setQuantityStock(double QuantityStock)
                                                                           {//8
                                                     quantityStock = QuantityStock;
                                                                             }//8
                                                          public String getItemName()
                                                                             {//9
                                                      return itemName;
                                                                                     }//9
                                                          public int getItemNumber()
                                                                                     {//10
                                                      return itemNumber;
                                                                                            }//10
                        public String getInvetoryHardware()
                                                                                              {//11
                        return inventoryHardware;
                                                                                                }//11
                                                          public double getUnitPrice()
                                                                                                   {//12
                                                     return unitPrice;
                                                                                                     }//12
                                                          public double getQuantityStock()
                                                                                                           {//13
                                                    return quantityStock;
                                                                                                            }//13
                                                          public String getInventoryHardware()
                                                                                                                  {//14
                                                    return inventoryHardware;
                                                                                                                   }//14
                                                                               public double computeinventoryValue()
                                                                                                                        {//15
                                                                          return quantityStock * unitPrice;
                                                                                                                            }//15
                                                                                 public double computetotalInventory()
                                                                                                                                {//16
                                                               return totalInventory = totalInventory + inventoryValue;
                                                                                                                                  }//16               
                                                                                     public String toString()
                                                                                                                                  {//17
                                                                               return (itemName);
                                                                                                                                    }//17
            }//2
         }//40
                            // SubItem.java
                            // Sub class to main program
         public class SubItem extends Item
        {//18
                  private String inventoryHardware;
                  private double restockingFee = .05;
                        public SubItem(double UnitPrice,double QuantityStock,int InventoryHardware,int
                                               ItemNumber,String ItemName)
              {//19
                   setUnitPrice(UnitPrice);
                   setQuantityStock(QuantityStock);
                   setItemNumber(ItemNumber);
                   setItemName(ItemName);
                   inventoryHardware = InventoryHardware;
               }//19
                  public void setInventoryHardware(String InventoryHardware)
                       {//20
                     inventoryHardware = InventoryHardware;
                       }//20
                      public int getInventoryHardware()
                               {//21
                      return inventoryHardware;
                                }//21
                              public double computeRestockingFee()
                                       {//22
                    return ((getUnitPrice() * getQuantityStock()) * restockingFee);
                                        }//22
            }//18
                   private static BufferedReader stdin = new BufferedReader( new InputStreamReader(      
                    System.in ) );
                  private static int totalCount = 5;
          public Inventory4()
             {//23
         double unitPrice; // Unit price of each item
         double quantityStock; // Number of items in stock
         double inventoryValue; // Place holder for calculated inventory value
         double totalInventory; // Place holder for calculated total inventory value
         int itemNumber; // Item Number
         String itemName = ""; // Name of each item
                }//23
       public static void main(String[] args)throws IOException
           {//24
         SubItem myItem[];
          myItem = new SubItem[5];
        myItem[0] = new SubItem(10.35,20,4,1,"Traxx");
        myItem[1] = new SubItem(176.34,10,5,2,"Panels");
        myItem[2] = new SubItem(85.34,4,4,3,"Surfaces");
        myItem[3] = new SubItem(1.95,56,6,4,"Brackets");
        myItem[4] = new SubItem(82.34,8,1,5,"Overheads");
             printArray(myItem);
             myItem = sortArray(myItem);
             System.out.println(" Inventory List Sorted by Items \n\n");
              printArray(myItem);
        ItemButton itemButton = new ItemButton(myItem,totalCount); // Make ItemButton
        itemButton.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        itemButton.setSize( 350,390 ); // Window size
        itemButton.setVisible( true ); // display window
                   } //24 End Main Method
          private static SubItem[] printArray(SubItem[] myItem)
                          {//25
              double totalInventory = 0;
              double restockingFee = 0;
                         for (int i = 0; i<5;++i)
                          {//26
                               System.out.println("\n The Item Number is " + i + myItem.getItemNumber() );
                               System.out.println("\n Item Name is " + myItem.getItemName() );
                               System.out.println("\n Quantity in Stock is " + myItem.getQuantityStock() );
                               System.out.println("\n Inventory Hardware " +                                                    
                  myItem.getInventoryHardware() );
                               System.out.println("\n Inventory Value is $" + myItem.computeinventoryValue          
                               totalInventory = totalInventory + myItem.computeinventoryValue();
                               restockingFee = totalInventory + myItem.computeRestockingFee();
                                  } //26 End For Loop
                                   System.out.println("\n Total Value of all inventory is " + totalInventory);
                                   System.out.println("\n Total Value of all inventory with restock fee $" +             
                                       restockingFee);
                                   return myItem;
                                    }//25
       private static SubItem[] sortArray(SubItem[] myItem)
    {//27
          SubItem temp = new SubItem();
              int i, j;
             int array_size = 5;
             for (i = (array_size - 1); i >= 0; i--)
         {//28
                 for (j = 1; j <= i; j++)
               {//29
                       if (myItem[j-1].getItemName().compareTo(myItem[j].getItemName()) > 1)
                   {//30
                      temp = myItem[j-1];
                      myItem[j-1] = myItem[j];
                      myItem[j] = temp;
                    } //30 End if
                 } //29 End inner for loop
            } //28 End outer for loop
                              return myItem;
    } //27 End Method
    }//1
    // ItemButton.java
    // This will create GUI buttons.
    // Display the Items.
    import java.awt.FlowLayout;//line252
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JFrame;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JOptionPane;
    import javax.swing.SwingConstants;
      public class ItemButton extends JFrame
          {//31
            private JButton nextJButton; // text button
            private JButton prevJButton; // icon button
            private JLabel lblItemName; // text field with set size
            private JTextField txtItemName; // text field constructed with text
            private JTextField textField3; // text field with text and size
            private JLabel lblItemNumber; // text field with set size
            private JTextField txtItemNumber; // text field constructed with text
            private JLabel lblUnitPrice; // text field with set size
            private JTextField txtUnitPrice; // text field constructed with text
            private JLabel lblQuantityStock; // text field with set size
            private JTextField txtQuantityStock; // text field constructed with text
            private JLabel lblInventoryHardware; // text field with set size
            private JTextField txtInventoryHardware; // text field constructed with text
            private JLabel lblcomputeRestockingFee; // text field with set size
            private JTextField txtcomputeRestockingFee; // text field constructed with text
            private JLabel lblcomputeinventoryValue; // text field with set size
            private JTextField txtcomputeinventoryValue; // text field constructed with text
            private JLabel lblcomputetotalInventory; // text field with set size
            private JTextField txtcomputetotalInventory; // text field constructed with text
                SubItem[] arraySubItem;
                private int currentArrayCounter;
                private int arrayCount;
                   public ItemButton(SubItem[] myItem, int totalArrayCount)
           {//32
                    super ( "Inventory" );
                    arraySubItem = myItem;
                    arrayCount = totalArrayCount;
                    currentArrayCounter = 0;
                    setLayout( new FlowLayout() ); // set frame layout
                         Icon iconNext = new ImageIcon( getClass().getResource( "" ) );
                         Icon iconPrev = new ImageIcon( getClass().getResource( "" ) );
                                   lblItemName = new JLabel( "Item Name ");
                                   add( lblItemName ); // textField3 to JFrame
                                   txtItemName = new JTextField( "", 15 );
                                   add( txtItemName ); // add textField3 to JFrame
                                   lblItemNumber = new JLabel( "Item Number ");
                                   add( lblItemNumber ); // textField3 to JFrame
                                   txtItemNumber = new JTextField( "", 15 );
                                   add( txtItemNumber ); // add textField3 to JFrame
                                   lblUnitPrice = new JLabel( "Unit Price ");
                                  add( lblUnitPrice ); // textField3 to JFrame
                                  txtUnitPrice = new JTextField( "", 15 );
                                  add( txtUnitPrice ); // add textField3 to JFrame
                                  lblQuantityStock = new JLabel( "Quantity Stock " );
                                  add( lblQuantityStock ); // textField3 to JFrame
                                  txtQuantityStock = new JTextField( "", 15 );
                                  add( txtQuantityStock ); // add textField3 to JFrame
                                  lblInventoryHardware = new JLabel( "Inventory Hardware " );
                                 add( lblInventoryHardware ); // textField3 to JFrame
                   txtInventoryHardware = new JTextField( "", 15 );
                                 add( txtInventoryHardware ); // add textField3 to JFrame
                                 lblcomputeRestockingFee = new JLabel( "Restocking Fee ");
                                 add( lblcomputeRestockingFee ); // textField3 to JFrame
                                 txtcomputeRestockingFee = new JTextField( "", 15 );
                                 add( txtcomputeRestockingFee ); // add textField3 to JFrame
                                  lblcomputeinventoryValue = new JLabel( "Inventory Value " );
                                  add( lblcomputeinventoryValue ); // textField3 to JFrame
                                  txtcomputeinventoryValue = new JTextField( "", 15 );
                                  add( txtcomputeinventoryValue ); // add textField3 to JFrame
                                  lblcomputetotalInventory = new JLabel( "Total Inventory ");
                                  add( lblcomputetotalInventory ); // textField3 to JFrame
                                  txtcomputetotalInventory = new JTextField( "", 15 );
                                  add( txtcomputetotalInventory ); // add textField3 to JFrame
                   nextJButton = new JButton( "Next" ); // button with Next
                   prevJButton = new JButton( "Previous"); // button with Prev
                   add(prevJButton);
                   add(nextJButton); // add plainJButton to JFrame
                     ButtonHandler handler = new ButtonHandler();
                                          nextJButton.addActionListener( handler );
                                          prevJButton.addActionListener( handler );
                                          setTextFields();
    } //32 End ButtonFrame constructor
            private class ButtonHandler implements ActionListener
       {//33
          public void actionPerformed( ActionEvent event )
         {//34
               if (event.getActionCommand()== "prevJButton")
             {//35
                  currentArrayCounter++;
              }//35
                 else
                    {//36
                  currentArrayCounter++;
                      }//36
                        setTextFields();
           } //34 End Method ActionPerformed
    } //33 End Private inner class ButtonHandler
    private void setTextFields()
    {//37
               if (currentArrayCounter == arrayCount)
                  {//38
                     currentArrayCounter = 0;
                     }//38
               if (currentArrayCounter < 0)
                    {//39
                       currentArrayCounter = arrayCount;
                      }//39
                           txtItemName.setText(arraySubItem[currentArrayCounter].getItemName());
                           txtItemNumber.setText(arraySubItem[currentArrayCounter].getItemNumber()          
                  +"");
                           txtUnitPrice.setText(arraySubItem[currentArrayCounter].getUnitPrice()+"");
                           txtQuantityStock.setText(arraySubItem[currentArrayCounter].getQuantityStock      
                  ()+"");
                            txtInventoryHardware.setText(arraySubItem                           
    [currentArrayCounter].getInventoryHardWare()+"");
                            txtcomputeRestockingFee.setText(arraySubItem                           
    [currentArrayCounter].computeRestockingFee()+"");
                            txtcomputeinventoryValue.setText(arraySubItem                           
    [currentArrayCounter].computeinventoryValue()+"");
                            txtcomputetotalInventory.setText(arraySubItem                             
    [currentArrayCounter].computetotalInventory()+"");
      }//37
    } //31 End class ItemButton

  • Error in code, cannot figure it out. - class, interface, or enum expected

    IT is telling me i have an error in line 22 and it says class, interface, or enum expected
    import java.util.Scanner
    * @(#)Blahh.java
    * Blahh application
    * @author
    * @version 1.00 2010/1/29
    public class Blahh {
    public static void main(String[] args) {
         // TODO, add your application code
         System.out.println("Hello World!");
    // PURPOSE: An exercise in tracing a program and understanding
    // assignment statements and expressions.
    import java.util.Scanner
    Public class Trace
    public static void main (String[] args)
    int one, two, three;
    double what;
    Scanner scan = new Scanner(System.in);
    System.out.print ("Enter two integers: ");
    one = scan.nextInt();
    two = scan.nextInt();
    system.out.print("Enter a floating point number: ");
    what = scan.nextDouble();
    three = 4 * one + 5 * two;
    two = 2 * one;
    system.out.println ("one " + two + ":" + three);
    one = 46 / 5 * 2 + 19 % 4;
    three = one + two;
    what = (what + 2.5) / 2;
    System.out.println (what + " is what!");
    }}

    youngtron92 wrote:
    IT is telling me i have an error in line 22 and it says class, interface, or enum expected
    import java.util.Scanner
    * @(#)Blahh.java
    * Blahh application
    * @author
    * @version 1.00 2010/1/29
    public class Blahh {
    public static void main(String[] args) {
         // TODO, add your application code
         System.out.println("Hello World!");
    // PURPOSE: An exercise in tracing a program and understanding
    // assignment statements and expressions.
    import java.util.Scanner
    Public class Trace
    public static void main (String[] args)
    int one, two, three;
    double what;
    Scanner scan = new Scanner(System.in);
    System.out.print ("Enter two integers: ");
    one = scan.nextInt();
    two = scan.nextInt();
    system.out.print("Enter a floating point number: ");
    what = scan.nextDouble();
    three = 4 * one + 5 * two;
    two = 2 * one;
    system.out.println ("one " + two + ":" + three);
    one = 46 / 5 * 2 + 19 % 4;
    three = one + two;
    what = (what + 2.5) / 2;
    System.out.println (what + " is what!");
    }}Is that all a single source file? The import statement(s) need to be at the top, and each import has to be terminated by a semicolon.
    Also this is wrong. Case matters.
    Public class Trace

  • Syntax error on keyword "void"; "interface", "class" expected

    When migrating my application for Visual-Age to Web-Sphere 5.1
    The following error occurred:
    Syntax error on keyword "void"; "interface", "class" expected
    for the code:
    * ejbLoad method comment
    * @exception javax.ejb.EJBException The exception description.
    public void ejbLoad() throws javax.ejb.EJBException{
         _initLinks();
    }Thanking you in an advance

    I had missed a closing breacket '}'

  • Java '.class' expected, simple but im not seeing it

    I'm working on a project right now and need to list 3 parellel arrays. This is what my compiler error looks like.
    '.class' expected ')' expected
    It's really bugging be, so here are the two methods.
    This is the code that my info is being sent to. This method is in a class named ListPets
    public void listPets(String[] name, double[] price, int[] quanity)
              for(int i = 0; i<name.length; i++)
                   output+="\n"+name[i]+"       "+price[i]+"          "+quanity;
    this is what is being sent to it
    This code is in a class called MainGui
    I also have this little bit at the top.
    ListPets panList = new ListPets();
         public void actionPerformed(ActionEvent ae)
         panList.listPets(petname[], petprice[], petquanity[]);
    }I feel like im over looking somthing, but i cant find it. Any help on this would be nice, thanks,

    panList.listPets(petname[], petprice[] , petquanity[]);You are trying to call a method in the line of code above. So you should only include the variable names, like thispanList.listPets(petname, petprice, petquanity);Some feedback on your design: It looks like you have (at least) 3 arrays whose contents relate to each other. That is, petname[2] is a pet type's name, petprice[2] is the same pet type's price and petquantity[2] is the same pet type's quantity. In Java, you should not use "parallel arrays" to associate the contents of arrays. Instead, you should have a class - that's the whole idea of object oriented programming.

  • '.class' expected

    import java.lang.String;
    class StringDemo
    public static void main(String args[])
      //create 3 strings
      String s1="This is Dog";
      String s2= new String(" I LIke It");
        char arr[]={"l","a","k","s","h","m","i"};
        String s3= new String(arr[]);
       //display the strings
      System.out.println("s1="+s1);
       System.out.println("s1="+s2);
       System.out.println("s1="+s3);
       //find no'of characters in s1
       System.out.println(" Length ofs1="+s1.length());
      //join s1 with s2
       System.out.println("s1 joined with s2="+s1.concat(s2));
      //join 3 strings using +
       System.out.println(s1+"at="+s3);
      //test s1 starts with this or not
      boolean x=s1.startsWith("This");
      if(x==true)
      System.out.println("starts with thiss1=");
      else
       System.out.println(" notstart ");
    //extract substrings from s2 and s3
    String p=s2.substring(0,5);
      String  q=s3.substring((0));
       System.out.println(p+q);
    //convert the case of s1
    s1.toUpperCase();
      System.out.println("Lower of s1="+s1);
    s1. toLowerCase();
    Hi, when i compile this program it gives an error like
    StringDemo.java:10: '.class' expected
        String s3= new String(arr[]);
                                   ^
    StringDemo.java:10: ')' expected
        String s3= new String(arr[]);what's my mistake pls helpme
    ThanQu in advance

    import java.lang.String;
    class StringDemo
    public static void main(String args[])
    //create 3 strings
    String s1="This is Dog";
    String s2= new String(" I LIke It");
    char arr[]={"l","a","k","s","h","m","i"};
    String s3= new String(arr[]);This should be:
    String s3 = new String(arr);
    if(x==true)Although the above will work, you should not do this as a matter of style (it is redundant). Should be:
    if (x) {
    }

  • Use of events and interface in class

    Dear All,
    Could you please explain why we use events and interface in class.
    Also please tell me the use of TRY and ENDTRY.
    Regards,
    Amar

    Events may be a way of communication b/w classes. Imagine you want to call certain code from one class, you would need for that public method, but you don't want to expose it to external user. So you may use events for that. Also events are used to notify that certain state of class has changed (tiggering event). Then all handlers of this event executes and react accordingly.
    Interfaces are a way of provide a service to class which implements it. Imagine that you have class office and hotel and gas station . They don't seems to have something in common. However, there can be some external energy provider which will be an interface. Each class which want to have a lease with this energy provided can implement it (the implementation can differ in some way), so he can provided energy to different classes. This way you will achieve polimorphism (meaning you call one interface method, but code behind it differs from class to class).
    Interfaces are also means of multiple inheritance. One class can implement several service (interfaces). In contrary it can oly inherit from one class.
    Try endtry are just new way of handling exceptions .
    Try to search a litte bit you will find lots of info on the above.
    Regards
    Marcin

  • When calling method error .class expected

    First the method I'm calling.
    public void ExeSqlStmt(String sqlStmt, String columnNames[], String connectString, String userName, String password,int numColumns)
    This compiles clean. The code that calls the method is giving me fits with expecting .class, expecting ), can not resolve symble and unexpected type.
    The offending line is near the bottom of the code.
    Thanks,
    -Rob
    package jdba;
    * Execute the sql statement
    // java imports
    import java.util.Vector;
    import java.awt.event.*;
    import java.awt.Toolkit;
    import java.awt.Container;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.JScrollPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.JTable;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    // sql imports
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    public class SqlUtil extends JPanel
      Connection conn;  // database connection object
      Statement stmt;   // statement object
      ResultSet rslt;   // result set object
      // create someplace to put dat
      Vector data;     //    = new Vector();
      Vector columns;  //    = new Vector();
      Vector colHeads; //    = new Vector();     
      public SqlUtil()
        // setup panel
        JPanel sqlPanel = new JPanel(false);
        sqlPanel.setLayout(new BorderLayout());
        setBackground(Color.white);
        setForeground(Color.black);
      public void ExeSqlStmt(String sqlStmt, String columnNames[], String connectString, String userName, String password,int numColumns)
        data     = new Vector();
        columns  = new Vector();
        colHeads = new Vector();
        try
          // connect to database
          DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
          Connection conn = DriverManager.getConnection(connectString, userName, password);
          // select data into object
          stmt = conn.createStatement();
          rslt = stmt.executeQuery(sqlStmt);
          while (rslt.next())
            columns = new Vector();
            for ( int i=0; i<numColumns; i++ )
              colHeads.addElement(columnNames); // column heads
    columns.addElement(rslt.getObject(i+1)); // get the Object at i+1
    } // end for
    data.addElement(columns);
    // create the table
    JTable table = new JTable(data,colHeads);
    // add table to scroll pane
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    JScrollPane jsp = new JScrollPane(table,v,h);
    // Add scroll pane to content pane
    add(jsp, BorderLayout.CENTER);
    // close the result set and close the statement
    rslt.close();
    stmt.close();
    } catch (SQLException ex)
    String msg = "SQL error: "+ex.toString();
    } catch (Exception ex)
    String msg = "Error: "+ex.toString();
    } // end constructor
    } // end SqlUtil class
    // then we have the code that is calling and getting the errors
    package jdba;
    // java imports
    import java.util.Vector;
    import java.awt.event.*;
    import java.awt.Toolkit;
    import java.awt.Container;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.JScrollPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.JTable;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    // sql imports
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    // rollback contention
    public class RollbackContention extends JPanel
    Connection conn; // database connection object
    Statement stmt; // statement object
    ResultSet rslt; // result set object
    //private vars
    private String userName = "[cut]";
    private String password = "[cut]";
    private String sid = "rob";
    private String port = "1521";
    private String server = "[cut]";
    private String connectString = "jdbc:oracle:thin:@"+server+":"+port+":"+sid;
    private int numCols = 3;
    private String sqlStmt = null;
    private String prompt = null;
    private String colNames[] = {"name","waits","gets"};
    // constructor
    public RollbackContention()
    SqlUtil exeStmt = new SqlUtil();
    sqlStmt = "select name, waits, gets";
    sqlStmt = sqlStmt + " from v$rollstat, v$rollname";
    sqlStmt = sqlStmt + " where v$rollstat.usn = v$rollname.usn";
    // here is the offending line.
    exeStmt.exeSqlStmt(sqlStmt, colNames[], connectString, userName, password, 3);
    // loop through and display the rollback segments

    In your call your referencing the array as colNames[] - it should be colNames (no []'s )
    exeStmt.exeSqlStmt(sqlStmt, colNames, connectString, userName, password, 3);

  • .class expected error

    I am consistently recieving an error message that says ".class expected" on the "Easter date = new Easter (int year);" line every time i try to compile my tester class. Can anyone help me figure out the problem? Here is my tester/driver class:
    * Tester Class
    * Ben Mathews
    * September 13th, 2009
    public class EasterTester
    public static void main (String [ ] arg)
    Easter date = new Easter (int year );
    date.calculate ();
    }// end main
    }// end Easter

    When you post code, click on "CODE" to generate code tags and paste your code between the tags. Then it will look like this, which will help you get help. /*
    Tester Class
    Ben Mathews
    September 13th, 2009
    public class EasterTester
         public static void main (String [ ] arg)
              Easter date = new Easter (int year );
              date.calculate ();
         }// end main
    }// end Easter When you define a constructor (or a method) with a parameter, you have to tell the compiler what type that parameter is, for example //a constructor example
    public Easter(int year) But, when you use a constructor (or method) with a parameter, you just put in the value or variable, for example int year = 1999;
    Easter date = new Easter (year);

  • '.class' expected Error when trying to pass an Array

    In the below method I am trying to return an array. The compiler gives me one error: '.class' expected. I am not sure if I am writing the 'return' statement correctly and not really sure of another way to code it. Below is a portion of the code and I can post all of it if need be but the other methods seem to be fine.
    import java.util.Scanner;
    public class LibraryUserAccount
    Scanner input=new Scanner(System.in);
    private final int MAX_BOOKS_ALLOWED;
    private int checkedOutBookCounter;
    private long accountNumber;
    private String socialSecurityNumber, name, address;
    private final long isbnNumbers[];
    //constructor
    public LibraryUserAccount(long accountNumber, int maxBooksAllowed)
         this.accountNumber = 0;
         MAX_BOOKS_ALLOWED = maxBooksAllowed;
    //returns the array isbnNumbers[]
    public long getCheckedOutBooksISBNNumbers()
         return isbnNumbers[];
    The error displayed as:
    LibraryUserAccount.java:111: '.class' expected
         return isbnNumbers[];
    ^
    1 error
    Thanks in advance for the help.

    Rewriting the method as:
    public long[] getCheckedOutBooksISBNNumbers()
    return isbnNumbers;
    ... has fixed that particular compiler error. Thanks jverd. I appreciate the help.
    On a separate note I am having trouble with initializing the array. What I am trying to do is initialize an array of a size equal to a value passed to the class. Example being:
    //variables
    private final int MAX_BOOKS_ALLOWED;
    private long accountNumber;
    private final long[] isbnNumbers;
    //constructor method
    public LibraryUserAccount(long accountNumber, int maxBooksAllowed)
    this.accountNumber = 0;
    MAX_BOOKS_ALLOWED = maxBooksAllowed;
    long[] isbnNumbers = new long[MAX_BOOKS_ALLOWED];
    My goal is to set the size of isbnNumbers[] to the value of MAX_BOOKS_ALLOWED. I've tried a couple of different ways to initialize the array (the latest listed above) but the compiler doesn't like what I have done. Thanks again.

  • About interface and class[Please read this]

    I writing what I found out:
    myinterface.java
    interface myinterface
    class A
    A()
    {System.out.println("A()
    of interface");}
    A.java
    class A implements
    myinterface
    A(){System.out.println("A()
    of A.java");}
    public static void main
    (String args[])
    A a=new A();
    //this calls A() of interface
    //myinterface.java
    //how come the output of
    // this code is like this

    how come this is possible?Well, it had to pick one or the other, since they
    have the same symbol name. Why are you choosing to
    make up goofy names that collide in the first place?
    If you want to explicitly use one or the other, you
    need to also choose a package name, and fully-qualify
    the class name that you are trying to instantiate.For example:
    package test;
    interface MyInterface // renamed to follow standard naming convention
      class A
        A() { System.out.println("A() of interface"); }
    class A implements MyInterface
      A() {System.out.println("A() of A.java"); }
      public static void main(String args[])
        test.A a = new test.A(); // prints A() of A.java
        MyInterface.A a1 = new MyInterface.A(); // prints the other one
    }

  • .class expected? Double inside a for

    I'm trying to assign a random number to a double inside a for loop, but my compiler doesn't seem to like it. It's saying '.class expected' and 'not a statement', I was wondering if anyone would be so kind as to take a look at my code and give me some direction in what I'm doing wrong? I'm very new to java so I apologise if I'm a little slow on catching on. :)
    import java.util.Scanner;
    class Classroom {
      public static void main(String args[]) {
        Scanner gavroche = new Scanner(System.in);
    /*Gather Information*/
    System.out.print("What is your name? ");
    String name = gavroche.next();
    System.out.print("What grade are you in? ( 1-7 ) ");
    int grade = gavroche.nextInt();
    System.out.print("What type of test do you want to do? ( +, -, x, / ) ");
    String type = gavroche.next();
    /*Grade 1 test*/
    if (grade == 1) {
    /*Addition test*/
    if (type.equals("+"))
         System.out.println("Hello " + name + "!");
         for (int number = 0; number < 10; number++)
         double var1 = (int)(1+Math.random()*10);
         double var2 = (int)(1+Math.random()*10);
         System.out.println("What is " + var1 + " + " + var2 + "?");
         int answer = gavroche.nextInt();
         if (answer == var1+var2)
              System.out.println("Correct!");
         else if(answer != var1+var2)
              System.out.println("Wrong!");
    }Thank you!
    Edited by: grimsqueaker on Oct 25, 2007 7:02 PM

    grimsqueaker wrote:
    Braces where? It compiles fine without the two double var1 and var2.Yeah maybe. But the logic is all wrong.
    Try this formatting for starters
    import java.util.Scanner;
    public class Classroom {
      public static void main(String args[]) {
        Scanner gavroche = new Scanner(System.in);
        /*Gather Information*/
        System.out.print("What is your name? ");
        String name = gavroche.next();
        System.out.print("What grade are you in? ( 1-7 ) ");
        int grade = gavroche.nextInt();
        System.out.print("What type of test do you want to do? ( +, -, x, / ) ");
        String type = gavroche.next();
        /*Grade 1 test*/
        if (grade == 1) {
          /*Addition test*/
          if (type.equals("+")){
               System.out.println("Hello " + name + "!");
               for (int number = 0; number < 10; number++){
                 double var1 = (int)(1+Math.random()*10);
                 double var2 = (int)(1+Math.random()*10);
                 System.out.println("What is " + var1 + " + " + var2 + "?");
                 int answer = gavroche.nextInt();
                 if (answer == var1+var2){
                      System.out.println("Correct!");
                 }else if(answer != var1+var2){
                      System.out.println("Wrong!");
    }

Maybe you are looking for

  • VIOS DVR CAPACITY

    I FEEL SWINDLED!!!!!!   I just switched from DISH network to Verizon FIOS, where I had: 1. One  DVR with the capacity to record hundreds of shows and hundreds of hour of SD and HD plus the ability to store and easily retreive shows from a 750 GIG har

  • K330 - Crashed hard disk - service partition and drivers lost

    My 1 TB hard disk (D: drive) has crashed (after only half a year of operation ....). This harddisk did have the LENOVO partition with OKR and all drivers. From my supplier I got a new hard disk, but how to get OKR (using the F2 key) working again???!

  • Any idea how to stop CC from constantly reminding me to download a Market image I can't own?

    I was playing around in the Creative Cloud app yesterday. Way back in the stone age of the 1980s and 1990s, you could do that sort of thing. The way you learned how to become proficient was to experiment. Systems were generally set up (at least on th

  • I can not use my cursor on pages...it's gone how do I get it back?

    Hey, can anyone help me?  We just purchased this wonderful machine.  We've ALWAYS had a pc which makes this new adventure frustrating and exciting.  I decided to explore my pages documents and I experiemented and ended up losing my cursor.  Does anyo

  • Select group of images from IPAD

    I would like to know if it is possible to browse group of images or Album from IPAD(flex 4.5 mobile SDK)?