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)

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.

  • 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

  • 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

    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.

  • 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??)....

  • 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);
    }

  • Error during transport: Method is not declared + Component missing

    HI
    I got 2 errors when I transport:
    Error 1:
    Program ZCL_ZGW_VH_ORDER_DETAI_DPC_EXTCP, Include ZCL_ZGW_VH_ORDER_DETAI_DPC_EXTCO: Syntax error in line 000003
    Method 'DETSET_GET_ENTITY' is not declared or inherited in class 'ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT'. -
    Error 2:
    Program ZCL_ZGW_VH_ORDER_DE_01_DPC====CP, Include ZCL_ZGW_VH_ORDER_DE_01_DPC====CM006: Syntax error in line 000190
    The data object 'LS_ET_DETAILS' does not have a component called 'ZZ_MATR_LEV_DATO'.
    1)
    When I go to Class Builder (SE24), and make a syntax check for ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT, I got the error:
    Class ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT,Protected section
    Method "DETSET_GET_ENTITY" is not declared or inherited in class
    "ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT". -
    The code looks like this
    protected section.
      methods DETSET_GET_ENTITY
        redefinition .
    2)
    If I go to include ZCL_ZGW_VH_ORDER_DE_01_DPC====CM006 (in SE38), I am navigated to method: DETSET_GET_ENTITYSET (That was the missing method in error 1). When I do a syntax check, I got the error message:
    Class ZCL_ZGW_VH_ORDER_DE_01_DPC,Method DETSET_GET_ENTITYSET
    The data object "LS_ET_DETAILS" does not have a component called
    "ZZ_MATR_LEV_DATO".
    Then I double click at ls_gw_et_details-zz_matr_lev_dato, and got the data statement: DATA ls_gw_et_details LIKE LINE OF et_entityset.
    When I double click at et_entityset, I see that the et_enityset is type ZCL_ZGW_VH_ORDER_DE_01_MPC=>TT_ORDDET. Now I double click at TT_ORDDET I got the public section, where I can see that ZZ_MATR_LEV_DATO is already specified.
         ZZ_SPORSP_DATO type D,
         ZZ_KSTROM type STRING,
         ZZ_KSTROM_DATO type D,
         ZZ_MATR_LEV_DATO type D,
      end of TS_ORDDET. .
      types:
    TT_ORDDET type standard table of TS_ORDDET. .
    Anyone who will help me?
    Thanks
    Lars

    Hi Ron Sargeant,
    I'm having a kind of similar issue. I have 3 entities, they were already mapped to theirs respective RFC. In the RFC, a couple of fields changed their name so the mapping got lost. I did again the mapping and there was no errors on 2 of the 3 entities. For other reasons, I had to delete the third entitiy, I deleted it and created it again and there was no problems, I do the mapping and everything was apparently fine, when I tried to "Generate Runtime Objects" it throws me an error with the next message: "Failed to create data provider class". If I try to Generate the service again, it throws me another error message: "The class ZCL_xxx_xx_xxxxxx_DPC is locked. Process canceled". I'm sure I've not edited or deleted the DPC class. If I try to access the DPC class from the tx SE24 it tells me that the object it's not created, and the class still appears in the list of Runtime Artifacts in tx SEGW.
    I'd like to know if you've got any idea of what may happen, or I'd also like to be sure that if I delete the DPC class and the DPC_EXT class, it will be regenerated again by the Service Builder.
    Best regards,
    Ana Velásquez

  • 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

  • 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

  • Java.lang.NoSuchMethodError: java/util/Vector method revove...

    After using jexegen from microsoft to make EXE. I receive this error when i execute the my EXE :
    java.lang.NoSuchMethodError: java/util/Vector method revove...
    Any body know why?
    If i execute from JBuilder i have no problem!

    hi, i don't have much experience with M$ java products, but as far as i remember, M$ java stopped developping since jdk 1.1.4 (or 1.1.7).
    maybe that's the reason for throwing this exception. if you want to "exe" your class-file, try JToExe.
    greetzzz
    chris

  • Why java allow start() method only once for a thread

    Hi ,
    Why java allows start method only once for thread . suppose
    Thread t = new Thread();
    t.start();
    say at later stage if again we call t.start() IllegalStateException is thrown , even though isAlive method returns false.
    Hence the question , why start() method is allowed only once.If you need start a thread , we need to create a new instance.

    Really. Why do you think that? Do you have any evidence? It is one of the first things I would think of, personally.Considering that the Thread API doesn't allow you to specify a stack address (only stack size), I think it demonstrates they wanted to remove that capability from their Thread API all together. That missing "capability" makes me believe they want me to believe it's not something I need to worry about when using their API... I think the exact semantics of the Thread class and its methods were driven by how to make it most understandable and usable for their customers. I'm certain this issue was one of many that was given considerable thought during the design and implementation of the JVM and the underlying runtime classes.
    Do I have any evidence? No. But if you can point me at some first-hand information on this, I'd love to read it. Most of what I've found is second or third hand accounts. (and I mean that sincerely, not as a smart-ass remark or rebuke of your comments).
    On the one hand you seem to think the Java API designers are idiots, on the other hand you think that they should be. I can't make it out.I thought my position was that the Java developers were talented enough to implement platform in whatever way their API called for; hence, the designers made a choice about how they wanted their API to be used by their customers. They decided which capabilities they wanted to include or exclude, and created an API that was consistent with their vision for this technology. While I'm certain technical limitations had an effect on the API design, I certainly don't think the API was dictated by the them.
    I think the current design of the Java Thread API was a reflection of their vision to make Threading easier and more accessible to Joe Programmer, not limitations in the implementation. I never said it was wrong or that I could do better... I just said I think they could have done something different if they decided it would have made for a better customer experience. But hey, maybe I'm wrong.

  • Java interface as method arg question.

    Hello,
    Imagine that I have the following two interfaces and their associated classes:
    AI, AC, FooI, FooC
    where AC and FooC implements the interfaces AI and AC respectively. Assume than that FooI has contains only the following method:
    public void doIt(AI arg);
    So far so good. Now assume that FooC attempts to implement the method in it's interface like so:
    public void doIt(AC arg);
    The java compiler complains thusly:
    C:\moment\javatest>javac AC.java AI.java FooC.java FooI.java
    FooC.java:1: FooC should be declared abstract; it does not define doIt(AI) in FooC
    public class FooC implements FooI
    I was surprised by this result. Since AC honors AIs contract, why is the compiler complaining. If someone could explain the reasoning behind the error, I'd really appreciate it. Thanks in advance.
    -exits

    AC may be an implementation of AI, but not every implementation of AI is AC.
    The FooI interface is essentially insisting that the method work on every implemenation of AI. If you create a method that works only on a particular subset of AIs, namely ACs, then you haven't really implemented the method as specified.

Maybe you are looking for

  • Unable to capture "Sony Handycam" to iMac

    I bought Sony Handycam 2007 and worked on PC windows but this year I bought a new iMac computer but when I captured the video to iMac from the Sony Handycam and it won't open or work.... iMac said that I need to download software called MPEG or MPEG2

  • Brand new iMac cannot pair bluetooth keyboard and magic mouse

    Hi there! Just received brand new iMac 21" yesterday. Unboxed it, turned it on and none of both bluetooth devices (keyboard and magic mouse) managed to get paired. I was able to connect a USB mouse to log into the Mac. Did all turn off/on Bluetooth,

  • File download from client to server

    I am trying to set up a JSP/servlet to download a file from the client to the server in a webapp. The solution I thought about was to post a form using a <INPUT TYPE="file" > element But this does not work! In the form, I am setting the encoding to E

  • Layer Styles Not Saving for Use on Other Computers

    I've been trying over and over for the last 6 hours to get the layer styles I save in my custom pallet to work on other computers. I mean, I have a bunch of pallets from other sources and somehow they achieved a way of being able to save theirs, now

  • Problems with the receiver

    Hello, I've just got my Nike + iPod today. I inserted the receiver to my iPod Nano and nothing happened... When I go to Setting>About, there's no mention to the nike + ipod. The only place it shows in my iPod is under Settings>Main Menu. There I can