Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6960729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:26:20+00:00 2026-05-27T15:26:20+00:00

I have 3 class file, when i compile the class which extends the other

  • 0

I have 3 class file, when i compile the class which extends the other class gives compilation error like symbol not found.

public class  Animal {  
    public static void hide() {  
        System.out.println("Hide Method Of Animal");  
    }  

    public void override() {  
        System.out.println("The Override method of Animal");  
    }  
}  

public class Cat extends Animal {  
    public static void hide() {  
        System.out.println("Hide Method Of Cat");  
    }  

    public void override() {  
        System.out.println("The Override method of Animal");  
    }  
}  

public class TestAnimal {  
    public static void main(String args[]) {  
        Cat myCat = new Cat();  
        Animal myAnimal =  (Animal)myCat;  
        myAnimal.hide();  
        myAnimal.override();  
    }  
}  

I get this error:

TestAnimal.java:6: cannot find symbol  
symbol  : class Cat  
location: class com.Test.TestAnimal  
            Cat myCat = new Cat();  
            ^  

Any help on this???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:26:21+00:00Added an answer on May 27, 2026 at 3:26 pm

    Yes, see if there is a .class file for each .java file after you compile. If not, make sure that each one has a .class file.

    When you run, use the -classpath argument to point to the directory where all the .class files live.

    You sound like you could use some instruction on compiling and running Java.

    http://www.horstmann.com/bigj/help/compiler/tutorial.html

    Here’s the spoon feeding answer:

    1. Go to your d:\Mine\CoreJava\Programming directory in a command
      shell.
    2. Create a directory /classes
    3. Compile by typing javac -d classes -cp classes src/*.java
    4. You should see all the .class files created at once.
    5. Run by typing java -cp .;classes FullClassNameOfYourMain
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure which is as given below: class File { public
I have a class file which when i compile shows me Null pointer exception
We have a class Car defined like this in a car.rb file class Car
suppose I have a file alpha.h: class Alpha { public: template<typename T> void foo();
I have a class called MODEL in which public static int theMaxFrames resides. The
I have a .class file which is in jdk 1.1 version. When i tried
When I compile something like this: public class MyClass { void myMethod(String name, String
I have a class file that contains all the classes that are needed for
I currently have a class file with the following enumeration: using System; namespace Helper
I have created a C# class file by using a XSD-file as an input.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.