Complete newcomer question (cannot find symbol)

on terminal, I was given 20 error messages...
DemoVariables.java:11: cannot find symbol
symbol : variable sum
location: class DemoVariables
sum = value1 + value2;
^
DemoVariables.java:11: cannot find symbol
symbol : variable value1
location: class DemoVariables
sum = value1 + value2;
^
DemoVariables.java:11: cannot find symbol
symbol : variable value2
location: class DemoVariables
sum = value1 + value2;
^
DemoVariables.java:12: cannot find symbol
symbol : variable difference
location: class DemoVariables
difference = value1 - value2;
^
DemoVariables.java:12: cannot find symbol
symbol : variable value1
location: class DemoVariables
difference = value1 - value2;
^
DemoVariables.java:12: cannot find symbol
symbol : variable value2
location: class DemoVariables
difference = value1 - value2;
^
DemoVariables.java:13: cannot find symbol
symbol : variable product
location: class DemoVariables
product = value1 * value2;
^
DemoVariables.java:13: cannot find symbol
symbol : variable value1
location: class DemoVariables
product = value1 * value2;
^
DemoVariables.java:13: cannot find symbol
symbol : variable value2
location: class DemoVariables
product = value1 * value2;
^
DemoVariables.java:14: cannot find symbol
symbol : variable quotient
location: class DemoVariables
quotient = value1 / value2;
^
DemoVariables.java:14: cannot find symbol
symbol : variable value1
location: class DemoVariables
quotient = value1 / value2;
^
DemoVariables.java:14: cannot find symbol
symbol : variable value2
location: class DemoVariables
quotient = value1 / value2;
^
DemoVariables.java:15: cannot find symbol
symbol : variable modulus
location: class DemoVariables
modulus = value1 % value2;
^
DemoVariables.java:15: cannot find symbol
symbol : variable value1
location: class DemoVariables
modulus = value1 % value2;
^
DemoVariables.java:15: cannot find symbol
symbol : variable value2
location: class DemoVariables
modulus = value1 % value2;
^
DemoVariables.java:16: cannot find symbol
symbol : variable sum
location: class DemoVariables
System.out.println("Sum is " + sum);
^
DemoVariables.java:17: cannot find symbol
symbol : variable difference
location: class DemoVariables
System.out.println("Difference is " + difference);
^
DemoVariables.java:18: cannot find symbol
symbol : variable product
location: class DemoVariables
System.out.println("Product is " + product);
^
DemoVariables.java:19: cannot find symbol
symbol : variable quotient
location: class DemoVariables
System.out.println("Quotient is " + quotient);
^
DemoVariables.java:20: cannot find symbol
symbol : variable modulus
location: class DemoVariables
System.out.println("Modulus is " + modulus);
^
THE SOURCE:
public class DemoVariables
public static void main(String[] args)
int oneInt = 315;
short oneShort = 23;
long oneLong = 123456789876543L;
System.out.println("The int is " + oneInt);
System.out.println("The short is " + oneInt);
System.out.println("The long is " + oneLong);
sum = value1 + value2;
difference = value1 - value2;
product = value1 * value2;
quotient = value1 / value2;
modulus = value1 % value2;
System.out.println("Sum is " + sum);
System.out.println("Difference is " + difference);
System.out.println("Product is " + product);
System.out.println("Quotient is " + quotient);
System.out.println("Modulus is " + modulus);
int value1 = 43, value2 = 10, sum, difference, product, quotient, modulus;
Can anyone tell me what I did wrong?
Thanks...

Similar problem
This is the objective of my lesson: Develop a class to represents a human. The head, arms and legs should be properties of the human and should be represented by separate objects. All of your objects should have at least three properties and one method.
public class Human
     Head human_head;
     public Human(String color1, String size1, String color2)
          human_head = new Head(color1, size1, color2);
     public static void main(String[] args)
          Human mke = new Human("green", "big", "blonde");
          System.out.println("My name is Phil I have " + mke.human_head + "eyes head hair");
C:\java_code>javac usingobjects\Human.java
usingobjects\Human.java:8: cannot find symbol
symbol : class Head
location: class usingobjects.Human
Head human_head;
^
usingobjects\Human.java:14: cannot find symbol
symbol : class Head
location: class usingobjects.Human
human_head = new Head(color1, size1, color2);
^
2 errors
C:\java_code>

Similar Messages

  • Newbie question: cannot find symbol symbol: class STRING

    I've just decided to teach myself some java, and on my first try something's going wrong and I don't know what it is.
    I'm currently doing this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html
    and everything is good until I try to compile it and I get this error in the cmd
    HelloWorldSwing.java:30: cannot find symbol
    cannot find symbol
    symbol: class STRING
    everything has been written verbatim from the tutorial, including "import javax.swing.*;"
    What's wrong with it and how do I fix it?

    Hi,
    I saw the coding that You had given a link in your post. Change the following
        public static void main(String[] args) {bye for now
    sat

  • Issue with - "cannot find symbol - variable JOptionPane"

    need some help, got the below loop and want it to be able to loop by the number input by the input dialog. when i compile it i get an error in BlueJ. the error is "cannot find symbol - variable JOptionPane". Any help. have tried a few things however cannot get this to work at all. any suggestions?
    public void numberLoop()
    String qA = JOptionPane.showInputDialog(null,"How many times should this be completed (e.g. 1,2,3,4)?","Question",JOptionPane.QUESTION_MESSAGE);
    int qA2 = Integer.parseInt(qA);
    for (int startNum = 1; startNum <= qA2; startNum++)
    System.out.println(startNum + " squared is " + (startNum * startNum));
    }

    never mind i fixed it. forgot the below.
    import javax.swing.JOptionPane;
    LOL

  • CANNOT FIND SYMBOL !! T.T

    i have trry reading th archive thread about this but i dont understand a word
    iam really new to java
    i have this problem
    symbol  : variable cirumference
    location: class CircleCirum
    *          cirumference = 2 * 3.14 * radius;*
    *          ^*
    C:\Documents and Settings\Administrator\Desktop\CircleCirum.java:27: cannot find symbol
    symbol  : variable cirumference
    location: class CircleCirum
    *          JOptionPane.showMessageDialog(null, "The Cirumference of the circle is " + cirumference + ".");*
    *          ^*
    *2 errors*
    Tool completed with exit code 1
    i uninstall and reinstal textpad to my C:/program files
    so what the first thing i have to do to make this work?

    hiddendragon wrote:
    public static void main(String[] args)
              String input;
              int radius, circumference;
    u mean this??Yes, but, it's hard to know how this relates to your problem without seeing compilable code. Your best bet here is not to show your whole program, but to condense your question/problem into a single small class that is compilable by any and all of us, and demonstrates your problem. In other words, a [Short, Self Contained, Correct (Compilable), Example or SSCCE|http://homepage1.nifty.com/algafield/sscce.html] .
    Also, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, you will need to paste already formatted code into the forum, highlight this code, and then press the "code" button at the top of the forum Message editor prior to posting the message. You may want to click on the Preview tab to make sure that your code is formatted correctly. Another way is to place the tag &#91;code] at the top of your block of code and the tag &#91;/code] at the bottom, like so:
    &#91;code]
      // your code block goes here.
      // note the differences between the tag at the top vs the bottom.
    &#91;/code]or
    {&#99;ode}
      // your code block goes here.
      // note here that the tags are the same.
    {&#99;ode}good luck

  • Cannot find symbol and streams

    I am making some progress with implimenting the icaste jar file to control the serial port. My code is below. I have a problem with the statement osOut.write(bData,0,0); at the bottom of the code. cannot find symbol
    I am trying to write one byte to the serial port, I don't understand the use of the outputStream being used here from java.io , If I knew how the access worked on a lower level perhaps I could figure it out.
    In an AVR microcontroller for example, you set up the hardware on the chip to output a byte you place in a buffer, when there is data to read you have an interrupt set to jump to an isr routine that receives a byte and puts it in your own memory space or array. The hardware has a buffer it uses to hold some number of bytes and error flags to find out if you have a buffer overrun.
    Not sure if that concept is what is going on here or not.
    import com.icaste.JCommSerial.*;
    import java.io.*;
    public class newtest {
         * @param args
        public static void main(String[] args) {
            byte[] baData = new byte[1];
            baData[0]= (byte)255;
            String Errorstring = "None";
            System.out.println("Testing Serial port");
            SerialPort myPort = new SerialPort();
            try {
                myPort.openPort("COM1:", 2000, 2000);
            } catch(SerialPortNotFoundException e) {
                Errorstring="Serial port not Found";
            } catch(SerialPortInUseException e) {
                Errorstring="Serial port in use";
            } catch(SerialPortException e) {
                Errorstring="Serial port unable to complete operation";
            } catch(Throwable e) {
                Errorstring="unknown error";
            try {
                myPort.setBaudRate(9600);
            } catch(SerialPortException e) {
                Errorstring="Unable to set baud rate";
            try {
                myPort.setDataBits((byte)8);
            } catch(SerialPortException e) {
                Errorstring="Unable to set data bits";
            try {
                myPort.setStopBits(SerialPort.ONESTOPBIT);
            } catch(SerialPortException e) {
                Errorstring="Unable to set stop bit";
            try {
                myPort.setParityMode(SerialPort.NOPARITY);
            } catch(SerialPortException e) {
                Errorstring="Unable to set parity";
            try {
                OutputStream osOut = myPort.getOutputStream();
            } catch(IOException e) {
            try {
                osOut.write(baData, 0, 0);
            } catch(IOException e) {
                Errorstring="write byte failed";
            System.out.println("Error = "+Errorstring);
       

    Ok, I can finally put this question to bed. My main error was not knowing what the line of code actually was. After 4 hours of reading http://www.yu.edu/faculty/arosnfld/java/javanotes-3.1/c5/s3.html and a nice email from the tech at icaste, I finally understand what is going on and what it all means.
    If you would like to see what I am up too you can check out the DMX light prototype moveie I made a few weeka ago. It is using a program called freescale and a DMX controller connected to a USB port. The serial port can be configured to operate a USB port from windows point of view and that is my next quest to study how a USB port connection works on the hardware side.
    Thanks for the help and links, I wish there was more time in the day, and night to cram all this stuff in my head.
    Quicktime Movie (kind of big) http://www.acousticlights.com/ledmovie.m1v
    import com.icaste.JCommSerial.*;
    import java.io.*;
    public class newtest {
         * @param args
        public static void main(String[] args) {
            SerialPort myPort = new SerialPort();
            String Errorstring = "None";
            System.out.println("Testing Serial port ");
            try {
                myPort.openPort("COM1:", 2000, 2000);
            } catch(SerialPortNotFoundException e) {
                Errorstring="Serial port not Found";
            } catch(SerialPortInUseException e) {
                Errorstring="Serial port in use";
            } catch(SerialPortException e) {
                Errorstring="Serial port unable to complete operation";
            } catch(Throwable e) {
                Errorstring="unknown error";
            try {
                myPort.setBaudRate(9600);
            } catch(SerialPortException e) {
                Errorstring="Unable to set baud rate";
            try {
                myPort.setDataBits((byte)8);
            } catch(SerialPortException e) {
                Errorstring="Unable to set data bits";
            try {
                myPort.setStopBits(SerialPort.ONESTOPBIT);
            } catch(SerialPortException e) {
                Errorstring="Unable to set stop bit";
            try {
                myPort.setParityMode(SerialPort.NOPARITY);
            } catch(SerialPortException e) {
                Errorstring="Unable to set parity";
            try {
    //Get an OutputStream from JCommSerial and reference it by the name osOut.
    //assuming you already created a JCommSerial object called spPort
    // and opened it!
                OutputStream osOut = myPort.getOutputStream();
    //Write your byte to the port
    // the write() function takes an int that is then converted
    // to a byte for transmission.
                int iData = 255;
    // Send 254 bytes of data to the serial port
                while (iData >0) {
                    osOut.write(iData);
                    iData--;             
            } catch(Exception e){
                System.out.println(e.toString());
            System.out.println("Error = "+Errorstring);
    }

  • Error in importing user-created jar file & cannot find symbol

    Hello.
    I try to import the jar file made from common classes in the previous project. by using NB 5.5.1.
    The jar file is named as 'tpslib.jar'
    The previoud package name is 'tps'.
    I added tpslib.jar in the library, and removed the class files from the orginal project, because the class files exist in the tpslib.jar.
    THe jar file has 8 class files inclduing the following class, ReservationData.
    My question is why the follwoing fuction call try to the method in the previous package, tps instead of those of tpslib.jar.
    If you have anyone to answer me, it will be very appreciated.
    Tae
    package tps;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    import tpslib.*;
    public class tpsPWSImpl implements tpsPWSSEI {
    public ReservationData reserve(ReservationData request) throws java.rmi.RemoteException {
    request.print();
    requestLocal.print();
    if (!request.equalsCoreOf(requestLocal)){
    cFlag = true;
    System.out.println("reserve: WARNING ");
    ===================
    9 Error Messages
    ====================
    cannot find symbol
    symbol : method print()
    location: class tps.ReservationData
    request.print();
    cannot find symbol
    symbol : constructor ReservationData(tps.ReservationData)
    location: class tps.ReservationData
    wr = new ReservationData(rr);
    ===========

    Does your jar include:
    /a/Main.classWith class Main defined in package, er, "a"?

  • Cannot find symbol class

    I am having a "Cannot find symbol" problem. My Java is a bit rusty so I'm not exactly sure what it could be. I have two classes, City and SisterCities. The SisterCities references the City class. The City class compiles fine. Both classes are part of the same package. However, when I compile SisterCities, I get the error. Could you please tell me how to get the second class to recognize the first (import, extends, not really sure. I've tried alot) Here are those two classes so far...
    ****** City ********
    package hw01;
    public class City
         public final String name;
         public final String country;
         public final City [] sisters;
    public City (String name, String country)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [0];
    public City (String name, String country, City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [sisters.length];
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters;
    public void setSisters (City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters[i];
    public String getName ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.name;
    public String getCountry ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.country;
    public City [] getSisters ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.sisters;
    ******** SisterCities *********
    package hw01;
    import java.util.LinkedList;
    public class SisterCities
         public final LinkedList cityList;
    public SisterCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public void addCity (City city)
              // throw new RuntimeException ("Not implemented yet.");
              this.cityList.add(city);
    public int getNumCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public City getCity (int i)
              // throw new RuntimeException ("Not implemented yet.");

    final attribute members like "cityList" must be initialised when they're declared or inside the constructors
    if you want to compile, you'll also have to uncomment the "throws" in your methods (or return a value)
    (pay attention to the error messages the compiler gives you and paste them all when posting questions)

  • Java Error : cannot find symbol , symbol : class (jdk 1.6.0)

    Dear All,
    Please help me.
    I am running javac from a .bat file and i set the classpath in the bat file as follows.
    echo on
    :start
    set classpath = "C:\Program Files\Java\jdk1.6.0\bin;"
    set classpath = "C:\Program Files\Java\jdk1.6.0\jre\..\lib\tools.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\i18n.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0\jre\classes;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\ldapsec.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\mysql-connector-java-5.0.0-beta-bin.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\sunjce_provider.jar; C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\studio\system;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\j2ee-1.3.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jaas-1.0.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\activation.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jms-1.0.2b.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jta-spec1_0_1.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\mail.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\AbsoluteLayout.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\sql.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\rowset.jar;C:\Program Files\Java\jdk1.6.0\studio\lib\ext\jdbc20x.zip;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\servlet-2.3.jar;C:\Program Files\Java\jdk1.6.0\studio\beans\TimerBean.jar;c:\Program Files\Java\jdk1.6.0\ideset\tomcat401_base;C:\sms\com\;"
    cd C:\sms
    javac mainP.java
    pause
    i have few class files which are inherited to the main program using ' import com.Connection; '
    i am getting errors like
    mainP.java:482: cannot find symbol
    symbol : class Connection
    location: class mainP
    Connection connection = new Connection(ipAddress, port);
    I think it is because of some classpath error.
    please advice me.......
    Viju

    Actually, you have NO CLUE what he's trying to doActually he said what he is trying to do in his posting. It's no mystery. But that's all the information that's available. If you know something that isn't posted here why not say so?
    Your reply was a snide, rude, "You're stupid for doing it that way" answerMy reply was neither snide nor rude and implied none of what you impute to it. It was a proper and constructive suggestion. You are entitled to disagree with it, but that doesn't justify this immoderate outburst.
    Bottom line is, you chose to be nastyBottom line is you're just making this up. You are imputing motives to me without evidence. Don't do that.
    You are the type of person that makes searching forums and posting questions for assistance a near waste of time.I doubt that you'll find many regulars here that would agree with that assertion. When you have made over 16,000 posts here over ten years as I have, come back and we'll discuss it some more.
    Go back to grade school and ...I suggest you try it yourself. You're not adding anything except noise to the discussion. Try curbing your temper, and while you're at it have a good look at the Code of Conduct for these forums. You're verging on personal abuse here.
    And, additionally, I've used ANT in the past. Batch files are FAR AND AWAY easier to set up.In your opinion. I disagree entirely, and I have eleven years' experience with Java to back it up.
    As for CLASSPATH, I haven't done anything about setting it beyond installing the JDK since about 1999, and it has a dot in it as we speak.

  • 5 Errors Left: "Cannot find symbol variable "

    I think I have almost completed my error fixing but I cannot seem to figure out how to fix these last few errors I have.
    Here are my errors:
    --------------------Configuration: MadrigalRPA6 - JDK version 1.6.0_02 <Default> - <Default>--------------------
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:113: cannot find symbol
    symbol : variable size
    location: class ServicesArray
    servicesArray = new PetService[size];
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:115: cannot find symbol
    symbol : variable io
    location: class ServicesArray
    int size = io.readInt("How many services do you have to enter?");
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:123: cannot find symbol
    symbol : variable number
    location: class ServicesArray
    for(int i = 0; i < number; ++i)
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:135: cannot find symbol
    symbol : variable number
    location: class ServicesArray
    for(int i = 0; i < number; ++i)
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:144: cannot find symbol
    symbol : variable io
    location: class ServicesArray
    io.writeInfo(info);
    ^
    5 errors
    Process completed.
    * @(#)MadrigalRPA6.java
    * MadrigalRPA6 application
    * @author
    * @version 1.00 2007/11/5
    *     Program Purpose: This program is designed to store available services for
    *  Dr. Doolittle's Mobile Pet Clinic.
    import staugIO.StaugIO;
    //DECLARE PET SERVICES CLASS
    class PetService
    private String ServiceCode = " ";
    private String ServiceName = " ";
    private String ServiceDescription = " ";
    private String ServiceType = " ";
    private double price = 0.00;
    private StaugIO io = new StaugIO();
    //CONSTRUCTOR
    public PetService()
    //END CONSTRUCTOR
    //SET PET SERVICES NAME
    public void setServiceCode()
         ServiceCode = io.readString("Enter the service code");
    }//END setServiceCode()
    //SET SERVICE NAME
    public void setServiceName()
         ServiceName = io.readString("Enter the service name");
    }//END setServiceName()
    //SET SERVICE DESCRIPTION
    public void setServiceDescription()
         ServiceDescription = io.readString("Enter the service description");
    }//END setServiceDescription
    //SET SERVICE TYPE
    public void setServiceType()
         ServiceType = io.readString("Enter the service type");
    }//END setServiceType()
    //SET SERVICE PRICE
    public void setPrice()
         price = io.readDouble("Enter the service price");
    }//END setPrice()
    //GET PET SERVICE NAME
    public String getServiceCode()
         return ServiceCode;
    }//END getServiceCode()
    //GET SERVICE NAME
    public String getServiceName()
         return ServiceName;
    }//END getServiceName()
    //GET SERVICE DESCRIPTION
    public String getServiceDescription()
         return ServiceDescription;
    }//END getServiceDescription
    //GET SERVICE TYPE
    public String getServiceType()
         return ServiceType;
    }//END getServiceType
    //GET SERVICE PRICE
    public double getPrice()
         return price;
    }//END getPrice
    }//END PetService CLASS
    class ServicesArray
         PetService[] servicesArray;  // Code the reference to the null array.
    //CONSTRUCTOR
    public ServicesArray()
    //END CONSTRUCTOR     
    public void getSize()
         servicesArray = new PetService[size];     *////////ERROR HERE*
    //READ NUMBER OF SERVICES TO STORE
    int size = io.readInt("How many services do you have to enter?"); *///////ERROR HERE TOO*
    //DYNAMICALLY DEFINE ARRAY OF PET SERVICE OBJECTS
    PetService services[] = new PetService[size];
    //DEFINE PET SERVICE OBJECTS AND FILL ARRAY OF OBJECTS WITH PET SERVICE DATA
    for(int i = 0; i < number; ++i) */////////////ERROR HERE ASWELL*
    services[i] = new PetService();
    services.setServiceCode();
    services[i].setServiceName();
    services[i].setServiceDescription();
    services[i].setServiceType();
    services[i].setPrice();
    }//END FOR
    //BUILD OUTPUT STRING FROM ARRAY OF PET SERVICE OBJECTS
    //AND DISPLAY PET SERVICES ONE AT A TIME
    for(int i = 0; i < number; ++i) *////////HMM WOW THIS DOESN'T SURPRISE ME THAT I HAVE ANOTHER ERROR*
         String info = "PET SERVICE " + (i+1) + " DATA\n";
              info += "\nSERVICE CODE: " + services[i].getServiceCode() + "\n"
                   + "SERVICE: " + services[i].getServiceName() + "\n"
                   + "DESC: " + services[i].getServiceDescription() + "\n"
                   + "TYPE: " + services[i].getServiceType() + "\n"
                   + "PRICE: " + services[i].getPrice() + "\n";
    //DISPLAY PET SERVICE DATA
         io.writeInfo(info); *////////////ERROR HERE AS WELL*
    }//END FOR
    }//END getSize()
    }//END ServicesArray CLASS
    public class MadrigalRPA6
    public static void main(String[]args)
    PetService service = new PetService();
    }//END main()
    }//END MADRIGALRPA6 CLASS

    wow i simply added the
    private StaugIO io = new StaugIO();
    into my ServicesArray class and i got the process completed with no errors, thats awesome but what doesnt make sense is this summary of this assignment that i have:
    Code a program that will store available services for Dr. Doolittle's Mobile Pet Clinic. Let the user determine the size of the array. Once the array has been populated with service information, display the contents of the array one at a time in separate GUI windows. Screen capture your output to a Word file and submit it with everything else. Use the code on pp 365-367 in the textbook to help you. Assume that the spacing is always double after a period and colon. You may limit your array size to no more than 3 as indicated by the sample output below. Use the sample output to test your array.
    PET SERVICE NO. 1
    SERVICE CODE: DG-2478
    SERVICE: Dog Group I
    DESC: DHLPP, Corona, Bordetella, Rabies
    TYPE: Vaccine
    PRICE: $47.50
    PET SERVICE NO. 2
    SERVICE CODE: FL-3182
    SERVICE: Feline Group I
    DESC: FVRCP, FeLV, Rabies
    TYPE: Vaccine
    PRICE: $46.50
    PET SERVICE NO. 3
    SERVICE CODE: DG-4682
    SERVICE: Dog Spay
    DESC: Abdominal surgery to remove the ovaries and/or uterus
    (ovariohysterectomy).
    TYPE: Surgery
    PRICE: $57.50
    No where in my code do i even have any of this so how would the user be able to see this? Is this program designed to just display the SERVICE CODE: and then the user types in the DG-4682? etc etc..
    I ask this because I cannot view my dialog boxes because when I run the program i get nothing, just process completed, nothing else.

  • Jdk6 - cannot find symbol

    Hi,
    I've just encountered a problem compiling with sun jdk6, that I've never met before.
    I've the class Arch that uses objects of the class Node.
    I compile the Node class without any problem ( javac -cp "../lib/*" it/bcdm/di/core/Node.java); but while compiling the Arch class after that, I get
    cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         private Node da = null;
         ^
    Either the Node and the Arch class stay within the same folder it/bcdm/di/core.
    I've already tried to include within the classpath, the path of the folder containing the file Node.class, in this way:
    javac -cp "../lib/*;it/bcdm/di/core/*" it/bcdm/di/core/Arch.java
    and I've also already tried this:
    export CLASSPATH=$CLASSPATH:/pathOfMyProject/it/bcdm/di/core/
    and also
    export PATH=$PATH:/pathOfMyProject/it/bcdm/di/core/
    but unsuccessful...
    this is the output of the verbose compilation mode:
    [parsing started it/bcdm/di/core/Arch.java]
    [parsing completed 35ms]
    [search path for source files: ../lib/*,it/bcdm/di/core/*]
    [search path for class files: /usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/resources.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/rt.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/jsse.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/jce.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/charsets.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/classes,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/localedata.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/dnsns.jar,../lib/*,it/bcdm/di/core/*]
    [loading java/lang/Comparable.class(java/lang:Comparable.class)]
    [loading java/lang/Object.class(java/lang:Object.class)]
    [loading java/lang/String.class(java/lang:String.class)]
    it/bcdm/di/core/Arch.java:5: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         private Node da = null;
         ^
    it/bcdm/di/core/Arch.java:6: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         private Node a = null;
         ^
    [loading java/lang/ClassCastException.class(java/lang:ClassCastException.class)]
    it/bcdm/di/core/Arch.java:49: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public Node getFrom(){
         ^
    it/bcdm/di/core/Arch.java:52: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public Node getTo(){
         ^
    it/bcdm/di/core/Arch.java:72: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public void setFrom(Node x){
         ^
    it/bcdm/di/core/Arch.java:75: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public void setTo(Node y){
         ^
    [checking it.bcdm.di.core.Arch]
    [loading java/lang/Error.class(java/lang:Error.class)]
    [loading java/lang/RuntimeException.class(java/lang:RuntimeException.class)]
    [loading java/lang/Exception.class(java/lang:Exception.class)]
    [loading java/lang/Throwable.class(java/lang:Throwable.class)]
    this is my java version:
    java version "1.6.0_07"
    Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
    Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)
    and I made these attempts either in debian and in windows XP, with the same java version installed.
    have you any idea to solve this compilation error?

    warnerja wrote:
    masijade, I think you might be confused as to what the OP is doing with that asterisk. As yawmark shed some light on it earlier, the wildcard lets the user conveniently include all .jar files it finds in the /lib directory, as if the user did this:
    -cp /lib/one.jar;/lib/two.jar;/lib/three.jar
    (assuming the /lib directory contains one.jar, two.jar, and three.jar)Yes, I know, but the op is complaining that he just compiled "Node", then by compiling "Arch" it could not find "Node", which means it won't be in those jars, anyway. (Edit: If he had used a -d option, the classes would have been in that directory, but then the "*", I believe, would hinder, not help, at least in respect to those newly compiled classes.)
    Also, OP, if you are not specifiying a -d option, then you also need to include "." on the classpath, as the classfiles will appear "in place" (i.e. right alongside the corresponding java files when compiled using the above command), which means that "." must also be on the classpath (as that is the "root" for the newly compiled classes).
    Edit Again, Although I will admit I hadn't remembered about the "*" being a new feature in 6 (though now that it has been mentioned as such I do remember having read about it, once).

  • Help a Beginner? cannot find symbol error?

    class Box {
         double width;
         double height;
         double depth;
    Box(Box ob) {
              width = ob.width;
              height = ob.height;
              depth = ob.depth;
    Box(double w, double h, double d) {
         width = w;
         height = h;
         depth = d;
    double volume() {
         return width * height * depth;
    class BoxWeight extends Box {
         double weight;
         BoxWeight(double w, double h, double d, double m) {
              width = w;
              height = h;
              depth = d;
              weight = m;
    class DemoBoxWeight {
         public static void main(String[] args) {
              BoxWeight mybox1 = new BoxWeight(10, 20, 35, 34);
              double vol;
              vol = mybox1.volume();
              System.out.println("Weight of mybox1 is " + mybox1.weight);
    okay, this is basically from a book, but when I compile it in TextPad, it reads
    C:\Documents and Settings\Guest 1\Desktop\EPGY C015\Box\Box.java:27: cannot find symbol
    symbol : constructor Box()
    location: class Box
         BoxWeight(double w, double h, double d, double m) {
         ^
    1 error
    Tool completed with exit code 1
    Why is that and how can I fix it? :P

    Whenever you extend a class (here you're extending Box with BoxWeight), and create the subclass's constructor, the parent class's (or super class's) constructor gets called first whether it is explicitly called or not. So here in the BoxWeight constructor, the Box constructor is implicitly called:
    BoxWeight(double w, double h, double d, double m) {
      // even though you don't specify it, the Box() constructor is called here. 
      // it's as if you have here the call:
      super();
      width = w;
      height = h;
      depth = d;
      weight = m;
    }If you don't specify the super(), it get's implicitly called as the first call in the BoxWeight constructor. Notice that the implicit constructor has no parameters. Since Box does not have a constructor without parameters, this will throw an error. To get around this, you should explicitly call the super constructor with its proper parameters as the first method called in your BoxWeight constructor:
    BoxWeight(double w, double h, double d, double m) {
      super(w, h, d);  // *** here ***
      width = w;
      height = h;
      depth = d;
      weight = m;
    }

  • [Basic For Loop] "cannot find symbol" in ForUpdate part

    Dear All,
    I wonder why the following is an error:
         for ( int x=0; x < 10; x = y ) {
              int y = x + 1;
         }The formal specification is
    for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement
    However, as specified in http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.14, and if you disassemble the bytecode,
    "ForUpdate" part is always evaluated after the included statement,
    In other words, it is evaluated as:
         for ( ForInitopt ; Expressionopt ; ) {
              Statement(s);
              ForUpdateopt
         }Or
         for ( int x=0; x < 10;  ) {
              int y = x + 1;
              x = y;
         }So, the only reason I find "cannot find symbol" reasonable is just human convinience, but not technically correct.
    What do you think?
    Many thanks.

    Very good asif but once again you have not answered
    the question.
    why?My answer may be partialy correct.But you answer is fully correct.
    And don't appreciate me.I'm not good at programming(in Java) like you.
    The variable y has been declared inside the loop so
    you cannot access in the loop header.
    int y = 0;
    for ( int x=0; x < 10; x = y ) {
    y =  x + 1;
    /code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Errors in Servlet compilation - CANNOT FIND SYMBOL

    hi,
    i'm trying to compile a servlet "MyServlet" but i get 4 errors like this:
    +...\classes\com\servlet\MyServlet.java:353: CANNOT FIND SYMBOL+
    +symbol : variable com+
    location: class com.servlet.MyServlet
    private static Logger logger = Logger.getLogger(com/dao/MessageDAO.getName());
    (and 3 errors about variable "dao", methods "getName" and *"getLogger"*)
    i import (guess correctly...) the packages which contains getname abd getlogger:
    import org.apache.log4j.Logger;
    import com.dao.MessageDAO;
    may you please tell me where i make mistakes?
    thanks a lot!!!

    thanks yawmark, guess i made a step forward....
    but i still have this lonely error:
    ...\WEB-INF\classes\com\servlet\MyServlet.java:353: cannot find symbol
    symbol : method getName()
    location: class com.dao.MessageDAO
    private static Logger logger = Logger.getLogger(com.dao.MessageDAO.getName());
    +>But that sort of prompts the question, why are you using the MessageDAO logger in your servlet class?+
    sorry but i can't answer, i'm working on existing code and i've only to modify it...
    moreover i'm a java principiant...
    another question: looking messageDAO.java i've seen that there isn't the getName() method...but only this statement at the end (just before "}" ) of the file *("\" notation again*...):
    private static Logger logger = Logger.getLogger(com/dao/MessageDAO.getName());
    is it a great error?
    thanks

  • Please help. Cannot find symbol Error!

    I have been working on this code for days now. It keeps coming up with errors. The error says cannot find symbol. I will bold the areas that say that. I got it down to 23 from 42 but now I have no idea what the problem is. any help is greatly appreciated!! I only added a couple of them mainly because it is overwhelming. I can add the rest of someone replies. Thank you again. Oh and the Classpath is set right. I am compiling from the desktop where I have the file also. That was the first thing I checked after reading other threads related to this issue. :O)
    import javax.swing.*;
    import java.awt.event.*;
    public class InventoryPart4 extends JFrame
         private JTextArea text;
         private Inventory inv;
         private int view;
         public InventoryPart4() {
              super("Product");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // quit if the window is closed
              view = 0; // current one showing
              Product product;
              inv = new Inventory(4);
              product = new Product(1, "Salad", 3, 4.95); here
              inv.add(product, 0);
    product = new Product(2, "Dressing", 6, 3.00); here          
    inv.add(product, 1);
    product = new Product(3, "Bacon Bits", 2, 1.75);*here*
              inv.add(product, 2);
    product = new Product(4, "Croutons", 1, 1.75); here
              inv.add(product, 3);
              // sort
              inv.sort();
              // output
              for (int i = 0; i < 4; i++) {
                   System.out.println(inv.get(i));
              // total val
              System.out.printf("Total=$%.2f", inv.totalValue());
              //gui
              JPanel panel = new JPanel();
              panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
              text = new JTextArea(10,50);
              text.setEditable(false);
              panel.add(text);
              showProduct();
              JButton next = new JButton("Next");
    here          next.addProduct(new Product() {
                   public void actionPerformed(ActionEvent e) {
                        if (view < inv.size()-1) view++;
                        else view = 0;
                        showProduct();
              panel.add(next);
              getContentPane().add(panel);
         // view an item
         public void showProduct() {
              text.setText("Product Details:\n");
              text.append(inv.get(view).toString()+"\n");
              text.append(String.format
                        ("Value of all the Contents: $%.2f", inv.totalValue()));
         public static void main(String args [])
              InventoryPart4 invt = new InventoryPart4();
              invt.pack();
              invt.setVisible(true);
         } //end main
    } // end class InventoryPart1
    class Product {
    private int ProductItem;
    private int ProductStock;
    private double ProductPrice;
    public Product(int item, int stock, double price) {
    ProductItem = item;
    ProductStock = stock;
    ProductPrice = price;
    } //end three-argument constructor
    // set Product Item
    public void setProductItem(int item) {
    ProductItem = item; here
    } //end method set Product Item
    //return Product Item
    public int getsProductItem() {
    return productItem;
    } //end method get product Item
    //set Product Stock
    public void setProductStock(int stock) {
    productStock = stock;
    } //end method set Product Stock
    //return Product Stock
    public int getProductStock() {
    return productStock;
    } //end method get Product Stock
    public void setProductPrice(double price) {
    productPrice = price;
    } //end method setproductPrice
    //return Product Price
    public double getProductPrice() {
    return ProductPrice;
    } //end method get Product Price
    //calculate inventory value
    public double value() {
    return productPrice * productStock;
    }// end method get productPrice and productStock
    @Override
    public String toString() {
    return String.format("item=%3d units=%d price=%.2f value=%.2f",
    productItem, productStock, productPrice, value());
    }//end class Product
    class Inventory {
         private Product[] list;
         // constructor
         public Inventory(int size) {
              list = new Product[size];
         // complete value
         public double totalValue() {
              double val = 0.0;
              for (int i = 0; i < list.length; i++) {
                   val += list.value();
              return val;
         // add an item
         public void add(Product i, int p) {
              list[p] = i;
         // get an item
         public Product get(int i) {
              return list[i];
         // sort by name
         public void sort() {
              // bubble sort
              int n = list.length;
              for (int search = 1; search < n; search++) {
                   for (int i = 0; i < n-search; i++) {
                        if (list[i].getProductItem().compareToIgnoreCase(list[i+1].getProductItem()) > 0) {
                             // swap
                             Product temp = list[i];
                             list[i] = list[i+1];
                             list[i+1] = temp;
         public int size() {
              return list.length;
    //extended class
    class Contents extends Product {
         private String Contents;
         // constructor
         public Contents(int item, String name, int units, double price) {
              super(item,name,units, price);
              this.contents = contents;
         // getter
         public String getContents() {
              return Contents;
         // total value with the 5% fee
         public double value() {
              return super.value()*1.05;
         // just the 5% fee
         public double fee() {
              return super.value()*0.05;
         // setter
         public void setContents(String contents) {
              this.contents = contents;
         public String toString()
              return super.toString() + String.format(" fee=%.2f contents=%-20s",
                        fee(), contents);

    The error says cannot find symbol.It says more than that. It says what symbol it cannot find, and it points to the line of code where the symbol was used.
              product = new Product(1, "Salad", 3, 4.95); *here*So it can't find a class called Product with an accessible constructor Product(int, String, int, double).
    product = new Product(2, "Dressing", 6, 3.00); *here*          
    inv.add(product, 1);
    product = new Product(3, "Bacon Bits", 2, 1.75);*here*
              inv.add(product, 2);
    product = new Product(4, "Croutons", 1, 1.75); *here*
              inv.add(product, 3);Ditto.
              JButton next = new JButton("Next");
    *here*          next.addProduct(new Product() {JButton doesn't have an addProduct() method.
    public Product(int item, int stock, double price) {This constructor doesn't match the constructor you are calling above, and there are no other constructors.
    ProductItem = item; *here*You must have a typo. But don't use inital capitals on field names: use them only on class names.
    return productItem;Here is evidence that you have a typo. Java is case-sensitive. Either the field is caled 'ProductItem' or it is called 'productItem', not both.
              // bubble sortDo you have to do this for the homework? Bubble sort is never used in real code except by people who don't know what they're talking about. Use Collections.sort().
              super(item,name,units, price);You should be getting a compile error here too. Ther is no such constructor for Product.
              return Contents;And here.

  • Cannot Find Symbol Error, please help.

    I am brand new to Java, so sorry if this question is obvious, but I keep receiving the following error when i try and compile the following code Circle.java
    Circle.java:17: cannot find symbol
    symbol : constructor Point()
    location: class pointClass.Point
    ^
    Circle.java:18: cannot find symbol
    symbol : method Point(double,double)
    location: class pointClass.Point
    super.Point(x,y); //set center to (x,y)
    ^
    2 errors
    I cant seem to figure out why I am getting this error, any help that anyone could provide would be greatly appreciated.
    This is the code for Circle.java:
    package circleClass;
    import pointClass.*;
    public class Circle extends Point
    private double radius; //Add a double radius field.
    public Circle()
    super(0,0); //call Point?s constructor initializing center to (0,0)
    radius = 0.0; //set radius to 0.0
    public Circle(double x, double y, double r)
    super.Point(x,y); //set center to (x,y)
    radius = r; //set radius to r
    public double r()
    return radius; //returns radius.
    public double getArea()
    return Math.PI*(radius*radius); //returns area of Circle object
    public double getCircumference()
    return 2*Math.PI*radius; //returns circumference of Circle object
    public String toString()
    return "center: ("+x+","+y+")"+"\nradius: "+r; //returns String that will give
    //output of the format...
    //center: (x,y)
    //radius: r
    If it helps, this is the code for pointClass:
    package pointClass;
    public class Point
    private double xcoor,ycoor;
    public static final Point ORIGIN = new Point();
    private Point()
    xcoor = 0;
    ycoor = 0;
    public Point(double x, double y)
    xcoor = x;
    ycoor = y;
    public double x()
    return xcoor;
    public double y()
    return ycoor;
    public String toString()
    return "(" + xcoor + "," + ycoor + ")";
    public static double distance(Point p, Point q)
    double dx = q.xcoor - p.xcoor;
    double dy = q.ycoor - p.ycoor;
    return Math.sqrt(dx*dx + dy*dy);
    Thanks for your help.

    {color:#000080}Both of your classes need to be in the same package, not each one in a package of its own. You have imported pointClass.Pont in Circle.java, but I don't think that's what you want to do. For a better understanding of packages, read{color}
    http://java.sun.com/docs/books/tutorial/java/package/index.html
    And post code like this:
    [code]CODE[/code] is displayed as CODE{color:#000080}db{color}

Maybe you are looking for

  • Nothing in firefox displays properly unless in full screen

    I started up my computer today and a norton window popped up informing me that a new version of the product was available. I went along with it and updated. Afterwards i opened up firefox to browse the web but instead of my home page i got a glitched

  • ThreadDumpScan tool for garbage collector trace analysis

    Hello, I would like to use the non official SAP tool ThreadDumpScan in order to have these nice graphs concerning the garbage collection. I have downloaded the std_server0.out from my server, where I can find  my GC activity, for instance : <GC(1): B

  • Oddity in searching - word not found in section.

    I have a table with a blob column that needs to be searchable. A CONTEXT index seems the best bet. The contents of this blob column are hierarchical in nature, as exemplified by <obj_entity> <app_entity> <obj_key> <app_id> 444EAE4FB9F34E4687D0F86D87E

  • Delta INIT problems in production system

    hi! How do you do, I hope all fine, well, I have a problem in production system, I execute the delta init and the data is in BW the problem is when I want to activate the data, the system give me a processing error, somebody can helpme please? BR

  • Detail information showing up on multiple areas of a report

    Post Author: Theresa Rose CA Forum: Crystal Reports I need detail information to show up on multiple areas of a report that I am working on.There are different areas on a form that I am working on that require multiple lines of detail information. I