hello dears,
please can anyone correct my java error, when i run bellow java source code error cause as can not find symbol.

public class StackApp{
    public static void main (String arg[]) {


        StackX theStack   = new StackX(10);
        theStack.push(20);
        theStack.push(40);
        theStack.push(60);
        theStack.push(80);

        System.out.println("Value at top : " + theStack.peek());
        System.out.println("Is Full at begining : " + theStack.isFull());

        while (!theStack.isEmpty()) {
            long value = theStack.pop();
            System.out.print(value);
            System.out.print(" ");
        }
        System.out.println("");
        System.out.println("Is Full at begining : " + theStack.isFull());

    }
}

Please post the full text of the compiler's error message that shows the source line and the error message.

this is my compilor error.

C:\Myjava>javac StackApp.java
StackApp.java:5: error: cannot find symbol
StackX theStack = new StackX(10);
^
symbol: class StackX
location: class StackApp
StackApp.java:5: error: cannot find symbol
StackX theStack = new StackX(10);
^
symbol: class StackX
location: class StackApp
2 errors

C:\Myjava>

If the class StackX is not in the same directory as this file, you will need to import the StackX class to reference it.

please clearly explain

Find the definition for the StackX class and put it on the classpath so the javac program can find it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.