Missing method body

class Board
    public static void main(String[] args)
        Board example = new Board();
    private Board();
        char array[][];
        array = new char[3][3];
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                array[i][j] = '.';
                System.out.println(array[i][j]);
}compiler says missing method body, but i can't think where the error is? private Board has to be a constructor.

Are you using a text editor or an IDE? If you are already fairly familiar with the Java programming language and the java/javac and you understand how classpath works, then you might consider to step over from the text editor to an IDE, such as Eclipse. It will save time and effort in developing. I tried to reproduce your problem in Eclipse and it clearly understrikes the "Board();" part during typing and says "This method requires a body instead of a semicolon" which makes much more sense.

Similar Messages

  • Missing method body or declare abstract error

    Hi!
    I have been working on this simple Java 1.3.1 program for three days now and cannot figure out what I am doing wrong. If anyone has done the "Building an Application" tutorial in the New to Java Programming Center, you might recognize the code. I am trying to set up a frame with panels first using the BorderLayout and then the FlowLayout within each section of the BorderLayout. It will have textfields and checkboxes. I am working on the code to retrieve the user input from the text boxes and also to determine which checkbox the user has checked. Here is my code: (ignore my irrelivent comments!)
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.Color.*;
    import java.awt.Image.*;
    //Header Comment for a Routine/Method
    //This method gathers the input text supplied by the user from five text fields on the Current
    //Purchase tab of the tabbed pane of the MPGLog.java program. The way it gathers the text
    //depends on the current processing state, which it retrieves on its own. It saves the text to
    //a text file called textinput.txt.
    public class CollectTextInput extends JPanel implements ActionListener
    { // Begin class
         //Declare all the objects needed first.
         // These are the text fields
         private JTextField currentMileage;
         private JTextField numofGallonsBought;
         private JTextField dateofPurchase;
         private JTextField pricePerGallon;
         private JTextField gasBrand;
         // Declaring the Labels to go with each TextField
         private JLabel lblcurrentMileage;
         private JLabel lblnumofGallonsBought;
         private JLabel lbldateofPurchase;
         private JLabel lblpricePerGallon;
         private JLabel lblgasBrand;
         // Declaring the Checkboxes for the types of gas bought
         private JCheckBox chbxReg;
         private JCheckBox chbxSuper;
         private JCheckBox chbxUltra;
         private JCheckBox chbxOther;
         private JCheckBox chbxHigher;
         private JCheckBox chbxLower;
         // Declaring the Buttons and images needed
         private JButton enter;
         private JButton edit;
         //private JButton report; //Will be used later
         private JLabel bluecar;          //Used with the ImageIcon to create CRV image
         private JPanel carimage;     //Used in buildImagePanel method
         private JPanel datum;          //Used in buildDatumPanel method
         private JPanel gasgrade;     //Used in buildGasTypePanel method.
         //Declaring the Panels that need to be built and added
         //to the border layout of this panel.
         //private JPanel panlimages;
         //private JPanel panltextinputs;
         //private JPanel panlchkBoxes;
         // Class to handle functionality of checkboxes
         ItemListener handler = new CheckBoxHandler();
         // This is where you add the constructor for the class - I THINK!!
         public CollectTextInput()
         { // Opens collectTextInput constructor
              // Must set layout for collectTextInput here
              // Choosing a BorderLayout because we simply want to
              // add panels to the North, Center and South borders, which, by
              // default, will fill the layout with the three panels
              // we are creating
              setLayout(new BorderLayout());
              //Initialize the objects in the constructor of the class.
              //Initialize the textfields
              currentMileage = new JTextField();
              numofGallonsBought = new JTextField();
              dateofPurchase = new JTextField();
              pricePerGallon = new JTextField();
              gasBrand = new JTextField();
              // Initialize the labels that go with each TextField
              lblcurrentMileage = new JLabel("Enter the mileage at the time of gas purchase: ");
              lblnumofGallonsBought = new JLabel("Enter the number of gallons of gas bought: ");
              lbldateofPurchase = new JLabel("Enter the date of the purchase: ");
              lblpricePerGallon = new JLabel("Enter the price per gallon you paid for the gas: ");
              lblgasBrand = new JLabel("Enter the brand name of the gas: ");
              //Initialize the labels for the checkboxes.
              chbxReg = new JCheckBox("Regular ", true);
              chbxSuper = new JCheckBox("Super ");
              chbxUltra = new JCheckBox("Ultra ");
              chbxOther = new JCheckBox("Other: (Choose one from below) ");
              chbxHigher = new JCheckBox("Higher than Ultra ");
              chbxLower = new JCheckBox("Lower than Ultra ");
              //Initialize the buttons that go on the panel.
              enter = new JButton("Save Data");
              edit = new JButton("Edit Data");
              //Initialize the image that oges on the panel.
              bluecar = new JLabel("2002 Honda CR-V", new ImageIcon("CRVBlue.jpg"),JLabel.CENTER);
              // Now bring it all together by calling the other methods
              // that build the other panels and menu.
              buildImagePanel();
              buildDatumPanel();
              buildGasTypePanel();
              // Once the methods above build the panels, this call to add
              //  them will add the panels to the main panel's border
              // layout manager.
              add(datum, BorderLayout.NORTH);
              add(carimage, BorderLayout.EAST);
              add(gasgrade, BorderLayout.CENTER);
         } // Ends the constructor.
            // This method creates a panel called images that holds the car image.
         public void buildImagePanel();
         { // Opens buildImagePanel.
              // First, create the Panel
              carimage = new JPanel();
              //Second, set the color and layout.
              carimage.setBackground(Color.white);
              carimage.setLayout(new FlowLayout());
              // Third, add the image to the panel.
              carimage.add(bluecar);
         }// Closes buildImagePanel
         //This method creates a panel called datum that holds the text input.
         public void buildDatumPanel();
         { //Opens buildDatumPanel
              // First, create the Panel.
              datum = new JPanel();
              //Second, set the background color and layout.
              datum.setBackground(Color.white);
              datum.setLayout(new GridLayout(2, 4, 20, 20));
              //Third, add the textfields and text labels to the panel.
              datum.add(lblcurrentMileage);
              datum.add(currentMileage);
              datum.add(lblnumofGallonsBought);
              datum.add(numofGallonsBought);
              datum.add(lbldateofPurchase);
              datum.add(dateofPurchase);
              datum.add(lblpricePerGallon);
              datum.add(pricePerGallon);
              datum.add(lblgasBrand);
              datum.add(gasBrand);
              //Optionally - Fourth -set a border around the panel, including
              // a title.
              datum.setBorder(BorderFactory.createTitledBorder("Per Purchase Information"));
              //Fifth - Add listeners to each text field to be able to
              //  know when data is input into them.
              currentMileage.addActionListener(this);
              numofGallonsBought.addActionListener(this);
              dateofPurchase.addActionListener(this);
              pricePerGallon.addActionListener(this);
              gasBrand.addActionListener(this);
         }// Closes buildDatumPanel
         // This method builds a panel called gasTypePanel that holds the checkboxes.
         public void buildGasTypePanel()
         { // Opens buildGasTypePanel method
              // First, create the panel.
              gasgrade = new JPanel();
              // Second, set its background color and its layout.
              gasgrade.setBackground(Color.white);
              gasgrade.setLayout(new GridLayout(5, 1, 10, 20));
              // Third, add all the checkboxes to the panel.
              gasgrade.add(chbxReg);
              gasgrade.add(chbxSuper);
              gasgrade.add(chbxUltra);
              gasgrade.add(chbxOther);
              gasgrade.add(chbxHigher);
              gasgrade.add(chbxLower);
              //Optionally, - Fourth - set a border around the panel, including
              // a title.
              gasgrade.setBorder(BorderFactory.createTitledBorder("Gas Type Information"));
              // Fifth - CheckBoxes require a CheckBox Handler.
              // This is a method created separately
              // outside of the method where the checkboxes are added to
              // the panel or where the checkboxes are even created.
              // This method (CheckBox Handler) implements and ItemListener
              // and is a self-contained method all on its own. See
              // the CheckBox Handler methods following the
              // actionPerformed method which follows.-SLM
         } // Closes the buildGasTypePanel method
    // Create the functionality to capture and react to an event
    //   for the checkboxes when they are checked by the user and
    //   the text fields to know when text is entered. Also to react to the
    //   Enter button being pushed and the edit button being pushed.
    public void actionPerformed(ActionEvent evt)
    { // Opens actionPerformed method.
         if((evt.getSource() == currentMileage) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the currentMileage text field
                //  and assigns it to the variable currentMileageText of
                //  type String.
                String currentMileageText = currentMileage.getText();
                lblcurrentMileage.setText("Current Mileage is:    " + currentMileageText);
                // After printing text to JLabel, hide the text field.
                currentMileage.setVisible(false);
           } // Ends if statement.
          if((evt.getSource() == numofGallonsBought) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the numofGallonsBought text field
                //  and assigns it to the variable numofGallonsBoughtText of
                //  type String.
                String numofGallonsBoughtText = numofGallonsBought.getText();
                lblnumofGallonsBought.setText("The number of gallons of gas bought is:    " + numofGallonsBoughtText);
                // After printing text to JLabel, hide the text field.
                numofGallonsBought.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == dateofPurchase) || (evt.getSource() == enter))
                     { // Opens if statement.
                       // Retrieves the text from the dateofPurchase text field
                       //  and assigns it to the variable dateofPurchaseText of
                       //  type String.
                       String dateofPurchaseText = dateofPurchase.getText();
                       lbldateofPurchase.setText("The date of this purchase is:    " + dateofPurchaseText);
                       // After printing text to JLabel, hide the text field.
                       dateofPurchase.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == pricePerGallon) || (evt.getSource() == enter))
                            { // Opens if statement.
                              // Retrieves the text from the pricePerGallon text field
                              //  and assigns it to the variable pricePerGallonText of
                              //  type String.
                              String pricePerGallonText = pricePerGallon.getText();
                              lblpricePerGallon.setText("The price per gallon of gas for this purchase is:    " + pricePerGallonText);
                              // After printing text to JLabel, hide the text field.
                              pricePerGallon.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == gasBrand) || (evt.getSource() == enter))
                       { // Opens if statement.
                         // Retrieves the text from the gasBrand text field
                         //  and assigns it to the variable gasBrandText of
                         //  type String.
                         String gasBrandText = gasBrand.getText();
                         lblgasBrand.setText("The Brand of gas for this purchase is:    " + gasBrandText);
                         // After printing text to JLabel, hide the text field.
                         gasBrand.setVisible(false);
           } // Ends if statement.
           // This provides control statements for the Edit button. If the
           //  Edit button is clicked, then the text fields are visible again.
           if(evt.getSource() == edit)
           { // Opens if statement.
             // If the edit button is pressed, the following are set to
             //  visible.
                currentMileage.setVisible(true);
                numofGallonsBought.setVisible(true);
                dateofPurchase.setVisible(true);
                pricePerGallon.setVisible(true);
                gasBrand.setVisible(true);
         }// Closes if statement.
    } // Closes actionPerformed method.
         private class CheckBoxHandler implements ItemListener
         { // Opens inner class
              public void itemStateChanged (ItemEvent e)
              {// Opens the itemStateChanged method.
                   JCheckBox source = (JCheckBox) e.getSource();
                        if(e.getStateChange() == ItemEvent.SELECTED)
                             source.setForeground(Color.blue);
                        else
                             source.setForeground(Color.black);
                        }// Closes the itemStateChanged method
                   }// Closes the CheckBoxHandler class.
    } //Ends the public class collectTextInput classThe error I keep receiving is as follows:
    C:\jdk131\CollectTextInput.java:128: missing method body, or declare abstract
         public void buildImagePanel();
    ^
    C:\jdk131\CollectTextInput.java:142: missing method body, or declare abstract
         public void buildDatumPanel();
    ^
    2 errors
    I have looked this error up in three different places but the solutions do not apply to what I am trying to accomplish.
    Any help would be greatly appreciated!! Thanks!
    Susan

    C:\jdk131\CollectTextInput.java:128: missing methodbody, or declare ?abstract
    public void buildImagePanel();^
    C:\jdk131\CollectTextInput.java:142: missing methodbody, or declare abstract
    public void buildDatumPanel();Just remove the semicolons.
    Geesh! If I had a hammer I would be hitting myself over the head with it right now!!! What an obviously DUMB newbie mistake!!!
    Thanks so much for not making me feel stupid! :-)
    Susan

  • Error message  "missing method body, or declare abstract"

    This is my test driver. Does anyone know why it is not working?
    public class TestInfo
       public static void main(String args[])
              Info results = new Info();
              printInfo();
         public static String printInfo();
              System.out.println(" The Diameter is: " + results.diam
              + " The Circumference is: " + results.circum
              + " The Area is: " + results.area);
    }The error message I get is: missing method body, or declare abstract
    The print block has to be a separate method. The print block works when I put it in main. When it is in a separate method and I call it in main it doesn't work

    You have an extraneous semi-colon after printInfo. This tells the compiler that that's all there is for that method, which only makes sense if it's an abstract method. It sees the block after the semicolon, but it thinks it's an initializer. So it wants you to either declare it abstract, or give it a method body.
    Just remove that semicolon and you're fine.

  • Java.lang.RuntimeException: Uncompilable source code - missing method body

    Hi,
    I am getting the following error at runtime
    java.lang.RuntimeException: Uncompilable source code - missing method body, or declare abstractwhen I try to instantiate a class using reflexion as following:
    MyInstance = MyClass.newInstance(); I have tried to find some explanation using Google, but could not find any that fit my case. MyClass's implementation has a public constructor with no parameter. There is no error at compile time when cleaning and building all code.
    Anyone has tips about what could cause this error?
    Thanks.

    Jrm wrote:
    It is not my code originally... You are making far too many unchecked assumptions about the reality of this situation to even get close to what that reality it is... Get over patronizing, it would improve your social/people skills... Thanks !It is your own problem that you perceive something as patronizing, while in fact it was only an honest and straight to the point attempt to help you. This forum does not deal in sensitivity, it gets in the way of helping people to see the error of their ways.

  • Missing method body and cannot resolve symbol

    I keep getting these two errors when trying to compile. I know that I need to call my fibonacci and factorial functions from the main function. Is this why I am getting the missing method body error? How do I correct this?
    Am I getting the cannot resolve symbol because I have to set the num and fact to equal something?
    Thanks
    public class Firstassignment
    public static void main(String[]args)
         System.out.println();
    public static void fibonacci(String[]args);
         int even=1;
         int odd=1;
         while (odd<=100);
         System.out.println(even);
         int temp = even;
         even = odd;
         odd = odd + temp;
    public static void factorial (String[]args);
         for (int count=1;
         count<=num;
         count++);
         fact = fact * count;
         outputbox.printLine("Factorial of" + num + "is" + fact);

    Hey... :o)
    the problem is that you've put semicolons at the end of the function signature, like this:
    public static void fibonacci(String[]args);
    }that should happen only when the function is abstract... so ur function should actually look like this:
    public static void fibonacci(String[]args)
    }also, i think you've missed out on the declarations (like what are fact and num??)....

  • Missing method body or declare abstract...

    Hi There,
    Im working on an assignment that works with the math class and performs a bunch of mathematical functions. Im trying to declare the different fields in the math class and I keep getting error messages!!
    This is what I have right now
    public class Math
        // Returns the absolute value of a double value.
        double abs(double a);
        // Returns the absolute value of a int value.
        int abs(int a);
        //Returns the greater of two double values.
        double max(double a, double b);
        //Returns the greater of two int values.
        int max(int a, int b);
        // Returns the lesser of two double values.
        double min(double a, double b);
        // Returns the lesser of two double values.
        int min( int a, int b);
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow(double a, double b);
        // Returns the remainder of division of two integers.
        int remainder(int a, int b);
        // Returns the closest long to the argument.
        long round(double a);
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr);
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr);
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};
        }When I try and compile it tells me that Im missing method body or declare abstract.
    I originally had this
       // Returns the absolute value of a double value.
        double abs;
        // Returns the absolute value of a int value.
        int abs;
        //Returns the greater of two double values.
        double max;
        //Returns the greater of two int values.
        int max;
        // Returns the lesser of two double values.
        double min;
        // Returns the lesser of two double values.
        int min;
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow;
        // Returns the remainder of division of two integers.
        int remainder;
        // Returns the closest long to the argument.
        long round;
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr);
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr);
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};When i tried doing this it told me that I had already declared the field previously when it got the the field with the same name and thats why I added the bit in brackets.....
    Im so lost... can anybody hep????

    hi,
    here is your code...
    modified by correcting my bad habit...
    he..he...
    public class Math
        // Returns the absolute value of a double value.
        double abs(double a){return 0.0;}
        // Returns the absolute value of a int value.
        int abs(int a){return 0;}
        //Returns the greater of two double values.
        double max(double a, double b){return 0.0;}
        //Returns the greater of two int values.
        int max(int a, int b){return 0;}
        // Returns the lesser of two double values.
        double min(double a, double b){return 0.0;}
        // Returns the lesser of two double values.
        int min( int a, int b){return 0;}
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow(double a, double b){return 0.0;}
        // Returns the remainder of division of two integers.
        int remainder(int a, int b){return 0;}
        // Returns the closest long to the argument.
        long round(double a){return 0.0;}
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr){return 0.0;}
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr){return 0;}
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};
        }if you want to extend Math class to any other class.. then make all the methods abstract
    dhaval.
    Edited by: Dhaval.Yoganandi on 1 Mar, 2008 3:48 PM

  • Color2.java:89: missing method body, or declare abstract

    I am creating a color chooser applet but I keep receiving this error please help me to resolve this as my heads wrecked.
    Here is my code:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class Color2 extends Applet implements AdjustmentListener, ActionListener
              Scrollbar redbar, grebar, blubar;
              TextField rfield, gfield, bfield;
              myColorSquare cSquare = new myColorSquare();
         public void init()
              cSquare.setSize(100,100);
              this.add(cSquare);
              Panel n= new Panel(new GridLayout(3,3));
              n.add(new Label("Red (0-255)"));
              this.redbar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,265);
              this.redbar.addAdjustmentListener(this);
              n.add(redbar);
              this.rfield = new TextField("0",5);
              this.rfield.addActionListener(this);
              n.add(rfield);
              n.add(new Label("Green(0-255)"));
              this.grebar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,265);
              this.grebar.addAdjustmentListener(this);
              n.add(grebar);
              this.gfield = new TextField("0",5);
              this.gfield.addActionListener(this);
              n.add(gfield);
              n.add(new Label("Blue(0-255)"));
              this.blubar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,265);
              this.blubar.addAdjustmentListener(this);
              n.add(blubar);
              this.bfield = new TextField("0",5);
              this.bfield.addActionListener(this);
              n.add(bfield);
              this.add(n);
         private void updateColor()
              int red = this.redbar.getValue();
              int green = this.grebar.getValue();
              int blue = this.blubar.getValue();
              this.rfield.setText(""+red);
              this.gfield.setText(""+green);
              this.bfield.setText(""+blue);
              Color aColor = new Color(red,green,blue);
              this.cSquare.updateColor(aColor);
         public void adjustmentValueChanger(AdjustmentEvent e)
              this.updateColor();
         public void ActionPerformed(ActionEvent e)
                   if (e.getSource().equals(this.rfield))
                        int red = new Integer(this.rfield.getText()).intValue();
                        this.redbar.setValue(red);
                   if(e.getSource().equals(this.rfield))
                        int blue = new Integer(this.bfield.getText()).intValue();
                        this.blubar.setValue(blue);
                   if (e.getSource().equals(this.bfield))
                        int green = new Integer(this.gfield.getText()).intValue();
                        this.grebar.setValue(green);
                   this.updateColor();
              class myColorSquare extends Canvas
              Color c = Color.black;
              public void paint(Graphics g);
                        g.setColor(this.c);
                        g.fillRect(0,0,this.getSize().width, this.getSize().height);
              public void updateColor(Color v)
                        this.c = v;
                        this.repaint();

    What happens if:
    public void adjustmentValueChanger(AdjustmentEvent e)
    is changed to:
    public void adjustmentValueChanged(AdjustmentEvent e)

  • Compiling Error Method body missing

    Ok so i have a program that reads in 6 grades for 10 different students takes the avg and prints outs the Name 6 scores avg and the letter grade they would recieve in a nice chart using printf in my main method i get the error MIssing method body or declare abstract. Any help as to why i am getting this would be much appreciated.
    import java.util.*;
    import java.io.*;
    public class Finals
        static Scanner input = new Scanner(System.in);
        public static void main(String[] args)throws IOException;
            Scanner inFile = new Scanner(FileReader("Grades.txt"));
            double [] [] scores = new double [10] [6];
            String [] name = new String [10];
            double [] grade = new double [6];
            char [] lettergrade = new char [10];
            int row = 0;
            int collum = 0;
            int collum2 = 0;
            int index = 0;
            while(inFile.hasNext())
                name[index] = input.Next();
                while(collum < 9)
                    scores[row][collum] = input.nextDouble();
                    collum = collum + 1;
                collum = 0;
                row = row + 1;
            inFile.Close();
            calculation(score, name, grade);
            print(score, grade, name, lettergrade);
        public static int calculation(double [] [] score, String [] name, double [] grade)
            int index = 0;
            int row = 0;
            int collum = 0;
            int j = 0;
            int m = 0;
            int k = 0;
            //add all the grades in the first row store that into a new array called average than run through a loop to find out what letter grade it equals store letter grade in a char array
            while(collum < 10)
                grade[j] = grade[j] + score[collum][row];
                row ++;
                if(row == 6)
                    collum ++;
                    row = 0;
                    j ++;
            return grade;
        public static void print(double [] [] score, String [] name, double [] grade, char [] lettergrade)
            int index = 0;
            int j = 0;
            while(index < 10)
                if(score[j] >= 92.5)
                    lettergrade[j] = 'A';
                    j ++;
                    index ++;
                else if(score[j] >= 82.5 && score[j] < 92.5)
                    lettergrade[j] = 'B';
                    j ++;
                    index ++;
                else if(score[j] >= 72.5 && score[j] < 82.5)
                    lettergrade[j] = 'C';
                    j ++;
                    index ++;
                else if(score[j] >= 62.5 && score[j] < 72.5)
                    lettergrade[j] = 'D';
                    j ++;
                    index ++;
                else
                    lettergrade[j] = 'F';
                    j ++;
                    index ++;
            System.out.println("Student    Test1   Test2   Test3   Test4   Test5   Average   Grade");
            System.out.printf("11%s40%d8%d5%c", name, score, grade, lettergrade);
    }

    public static void main(String[] args)throws IOException;Remove that semicolon.

  • Getting missing method error - first attempt at arrays

    I'm trying to work with arrays for the first time ever - I understand the concept, but can't quite get the syntax down. Here is the class which won't compile and is giving me a missing method body or declare abstract message - please help me understand what I'm doing wrong.
    import java.util.Scanner;
    import static java.lang.System.out;
    public class Inventory
      //declare and initialize variables
       private int itemNumber = 0;
       private String productName;
       private int stockAmount = 0;
       private double productCost = 0;
       private double totalValue = 0;
       private double totalInventory = 0;
       //initialize scanner
       Scanner input = new Scanner(System.in);
       public Inventory (int itemNumber, String productName, int stockAmount,
               double productCost, double totalValue);
       out.println("Please enter item number: "); //prompt for item number
          itemNumber = input.nextInt();
       out.println( "Enter product name/description: "); //prompt for product name
          productName = input.next();
       out.println("Quantity in stock: ");
          stockAmount = input.nextInt(); // prompt for stock quantity
       out.println("What is the product cost for each unit? ");
          productCost = input.nextDouble(); // prompt for product cost
            totalValue = stockAmount * productCost; //calculate stock value
          } // end calculate stock value
          { //request for inventory details
            out.printf("%s, which is item number %d, has %d pieces currently in " +
                "stock at a price of %.2f each. The total value of " +
                "inventory in stock is %.2f\n.", productName, itemNumber, +
                stockAmount, productCost, totalValue);
          } // end request
      }// end classHere is my main method - I don't think I'm referencing things the way I'm supposed to.
    public class Main {
      public static void main(String[] args) { //start main method
            Inventory inventory = new Inventory(); //call Inventory class
            inventory.inventoryInput();
    }

    LOL - you are right, I don't really know what I'm doing. I don't understand this and am just trying to muddle my way through this whole thing...as you can tell I'm facing many challenges.
    Here is how I've changed my main method and the Inventory class - still getting error messages though - any additional hints/suggestions?
    Inventory class
    import java.util.Scanner;
    import static java.lang.System.out;
    public class Inventory
      //declare and initialize variables
       private int itemNumber = 0;
       private String productName;
       private int stockAmount = 0;
       private double productCost = 0;
       private double totalValue = 0;
       private double totalInventory = 0;
       //initialize scanner
       Scanner input = new Scanner(System.in);
       public Inventory (int itemNumber, String productName, int stockAmount,
               double productCost, double totalValue)
       out.println("Please enter item number: "); //prompt for item number
          itemNumber = input.nextInt();
       out.println( "Enter product name/description: "); //prompt for product name
          productName = input.next();
       out.println("Quantity in stock: ");
          stockAmount = input.nextInt(); // prompt for stock quantity
       out.println("What is the product cost for each unit? ");
          productCost = input.nextDouble(); // prompt for product cost
            totalValue = stockAmount * productCost; //calculate stock value
          } // end calculate stock value
          { //request for inventory details
            out.printf("%s, which is item number %d, has %d pieces currently in " +
                "stock at a price of %.2f each. The total value of " +
                "inventory in stock is %.2f\n.", productName, itemNumber, +
                stockAmount, productCost, totalValue);
          } // end request
      }// end classMain method
    public class TestInventory
        public static void main(String[] args)
        {Inventory[] inventoryArray = new Inventory[3];
         inventoryArray[0] = new Inventory(0, 2541, Radios, 14, 15.95);
         inventoryArray[1] = new Inventory(1, 1685, VCR, 10, 98.95);
         inventoryArray[2] = new Inventory(2, 5872, Clock, 8, 12.95);
         For (Inventory inventory : inventoryArray)
             System.out.println(Inventory);
    }

  • WTK22 JSR172Demo - missing SOAP body

    Hi,
    I tried the sample JSR172Demo provided with WTK22, with the server running on localhost. Hence the WSDL port is as below:
    location="http://localhost:8080/serverscript2/serverscript"
    The service has been verified to be running. The stubs for the client generated using the KToolbar stub generator tool. The build was successful. However when the client is run and the service is invoked the following error is displayed on the Ktoolbar console:
    java.rmi.MarshalException: Missing SOAP Body or Envelope
         at example.serverscript.connector.Interface_Stub.request(+125)
         at example.serverscript.demo.Demo.run(+23)
    Please let me know if anyone has faced a similar problem and found a solution.
    Thanks,

    I have simular problem:
    "Missing SOAP Body or Envelope exception" when I'm trying to call web-service methos through internet.
    It seems there is something wrong with my computer security settings - can't imagine what's wrong.
    With local web-server everything works fine.
    I tryed to change Security Domain to Trusted, but this doesn't helps.
    Regards

  • SQL Developer Data Modelere 2.0.0 Structured Type Method Body

    I do not understand how to write a structured type method body.
    When I generate a DDL for my type there is no method body text in the script. I only see the text "-- Empty PL/SQL Body" and no code that i've put in the method properties

    Hi Artem,
    you can try 3.0 EA2 - it's fixed there.
    Philip

  • Using reflection to get method body

    Hi,
    I'm just getting into this side of program and while I understand the use of reflection in oredr to obtain the constructor and method, parameters, fields etc I was wondering if its possible to grab the method body and copy it into a string.
    So for example in the following class...
    class MyClass
    private String str;
    MyClass(){}
    public String MyMethod(String s)
    str=s;
    str=str+" was the String";
    System.out.println(str);
    return str;
    ...I need to capture just this code..
    str=s;
    str=str+" was the String";
    System.out.println(str);
    return str;
    ...as a string
    The reason i need to do this is that I'm programming a mechanism for storing objects and their methods using JDBC.. I could use object serialisation and store as a blob, but I'm wanting to store the attributes of a class as seperate parts so I can retrieve bits of code from the database at some later time.
    Thanks for any help you might give me
    peace
    neil

    You say that you are trying to store the method body
    into a database. This is to allow you to store an
    object and its methods into a database. Are you trying
    store the method text or its implementation (i.e class
    or java). If it is the implementation then just
    serialize the found method object using reflection.
    WHY are you doing this ?? what about private methods,
    class variables, class methods ???Hi, yes it is confusing to explain, but I'm experimenting with a new programming paradigm called AspectJ and I've only just got into Reflection. I'm creating a repository of Aspects (same as classes but with added functionality and some limitations) with JDBC and don't want to just serialise the object as a blob and so have created data tables to hold different parts of the anatomy of an Aspect and this was the only thing I was getting stuck on.
    The idea is that the user is able to recall these whole aspects (or a part of them such as a method) on the fly and use them in a program. I realise that ther will be problems because these methods may have other dependencies such as the ones you explain above but its just experimental at the moment and those are the kinds of things I'm wanting to find out more.
    I've seen examples of reflection for Objects but never for methods. So it is possible to capture just a method by serialisation using reflection? Any examples would be much appreciated.
    Peace
    Neil

  • Problems with loading native library/missing methods: no ttJdbcCS1121

    Hi guys,
    Im getting this problem in glassfish 2.1, but in glassfish 3 or in tomcat, i dont get this problem. (Windows)
    Any thoughts?
    java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbcCS1121 in java.library.path
    at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1750)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at com.summitinvt.mdaq.db.handler.DBConnector.getConnection(DBConnector.java:108)
    at com.summitinvt.mdaq.db.handler.DBConnector.initiateConnection(DBConnector.java:101)
    at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:34)
    at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:14)
    at com.summitinvt.mdaq.db.handler.DBConnector$DBConnectorUtil.<clinit>(DBConnector.java:24)
    at com.summitinvt.mdaq.db.handler.DBConnector.getInstance(DBConnector.java:28)
    at com.summitinvt.mdaq.rats.server.CommunicatorImpl.getPnLByCurrency(CommunicatorImpl.java:1074)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    regards
    John

    A similar problem was reported before on this Forum - see
    Re: not able create connection to timesten
    checking the Release Notes I can see 11.2.1.8.0 has been tested against Glassfish 3 but I
    can't see any mention about Glassfish 2 in the v7 or v11 Release Notes (albeit only on a quick
    search).
    In my full install on XP, ttJdbcCS1121.dll is in C:\TimesTen\tt1121_32\bin

  • Problems with loading native library/missing methods:no ttJdbcCS in java.li

    Iam facing one problem while connecting the timesten client to the server The SQL Exception which Iam getting is pasted below:-
    Problems with loading native library/missing methods: no ttJdbcCS in java.library.path
    I am working with MAC OS X 10.7.2 and my timesten client version is 11.2.1.0
    I have also changed the Java Preferences from 64-bit to 32-bit but still whenever i tried to connect with the SQL Developer it gives me the above error.

    I just tried this out. My environment is OS X 10.7.4, Timesten (32-bit) client 11.2.1.9.0, SQL Developer 3.1.07, Oracle Java 1.7.0_04.
    The key things you need to be sure to do (in a terminal window) are:
    1. Be sure to . in the TimesTen environment script <tt_install_dir>/bin/ttenv.sh to set the full TT environment.
    2. Change directory to SQLDeveloper.app/Contents/Resources/sqldeveloper
    3. Run 'sh sqldeveloper.sh -J-d32'
    and all should be fine.
    Note that if you are using Java7 as I am then there is a step 1a. Change the CLASSPATH environment variable to specify ttjdbc6.jar not ttjdbc5.jar. For some reason running the app directly from Finder does not work even if you add -J-d32 into the sqldeveloper launch script. I'm still looking into that.
    Chris

  • Problems with loading native library missing methods ttJdbc1122.dll

    Problems with loading native library/missing methods: C:\TimesTen\tt1122_64\bin\ttJdbc1122.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    Hi,
    I have installed TimesTen 11.2.2 64-bit version on 64-bit windows 7.
    I have TimesTen 7 64-bit as well installed on my machice
    When trying to connect to TimesTen (Direct connection) using jdbc from eclipse, I get the following error "Problems with loading native library/missing methods: C:\TimesTen\tt1122_64\bin\ttJdbc1122.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform".
    The JDK version is 1.6.25 - 64 bit version.
    Please help me resolving this error.
    Thanks in Advance,
    Balamurugan

    Are you using SQL Developer?
    There is or used to be a restriction of only being able to using 32 bit. A suggestion might be to try the 32 bit client.

Maybe you are looking for

  • Printer hp officeject 7700 is not interacting with the wifi and printing

    My hp officejet 7700 printer is not interacting with my mac/wifi.  

  • Posting for TDS

    Hello, can anybody tell me the all entry require for TDS(like first we do invoicing,then at the time of creation of remittance challan, have to process the open items, getting the line items as withholding tax etc.) i am confused with these enteries.

  • And condition for a value within same column

    Hi, I would like to select the rows from table which matches key='DKJ' and key='BK5' Is it possible to use exists condition here...to get the result only when it contains both the keys. Please could you suggest me alternative query for the below.. SE

  • PowerUsers Advise Requested

    I am not very computer saavy as I do not work daily on computers at a company and keep up to date with all of the new tips & tricks. I would like to use my computer more and paper less now that I have the mobility of a PowerBook G4. I just received i

  • Captivate 4 pause on button doesn't work

    What's up w/ Captivate 4 pause on buttons. I didn't have any problem with functionality using Captivate 3. Does anyone know what I could be doing wrong, I've rechecked all of the settings and I can't find one that will make the pause work.