Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: What is wrong with this code class not found

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default What is wrong with this code class not found

    Dear All,

    It would be great if someone could help me with this..

    I have one base class and other two extended classes.
    but when I try to compile the Noble.java it works fine without any compilation error

    when I try to compile PersonWithStrength.java it says cannot find symbol Noble

    when I try to compile Lord.java it gives me the same error cannot find symbol Noble


    javac Lord.java
    Lord.java:3: cannot find symbol
    symbol: class Noble
    class Lord extends Noble {



    All classes are made as different files in the same directory

    ###############Noble,java #################3

    class Noble {
    private final String name;
    private double totalStrength;

    public Noble(String p_name){
    this.name = p_name;
    }

    public Noble(String p_name, double p_strength) {
    this.name = p_name;
    this.totalStrength = p_strength;
    }
    }

    ###############Lord.java#####################
    package war;

    class Lord extends Noble {
    public Lord(String p_name){
    super(p_name);
    }
    }
    ###############PersonWithStrength.java############ #######
    package war;

    class PersonWithStrength extends Noble{

    public PersonWithStrength(String p_name, double p_strength) {
    super(p_name,p_strength);
    }
    }

    Please help me with this... any help would be appreciated!!


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: What is wrong with this code class not found

    Add the package declaration to Noble.
    package war;
    class Noble

    (Or remove it from Lord + PersonWithStrength, whichever matches your storage)
    Last edited by newbie; February 19th, 2011 at 06:42 PM.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. what's wrong in this code
    By Aravind in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 4th, 2011, 03:38 AM
  2. What's wrong with my code
    By javapenguin in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 10th, 2010, 03:24 PM
  3. What's wrong with my code ?
    By mithani in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 5th, 2010, 08:57 AM
  4. JRC export report class def not found
    By vishalthakur86 in forum Java IDEs
    Replies: 0
    Last Post: November 11th, 2009, 04:19 AM
  5. Main Class Not Found Problem
    By shadow in forum Java Theory & Questions
    Replies: 3
    Last Post: September 29th, 2009, 09:42 AM