Using inheritance in the package!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yulam4u
    New Member
    • Sep 2008
    • 2

    Using inheritance in the package!!

    hello people!!!

    i am having this problem while i am implementing inheritance in a package named"inherint" which is a sub-directory of the directory "shashikayubbi" !!!

    i've a super class inhr.java,a derived class inher.java !!!
    well the code runs completely ok when i am executing it from the directory "shashikayu bbi" , but when i put these files in the sub-dir "inherint" there is a problem at the time of compliling the code and the compiler responds "class:inhr not found"

    "Please don't tell me about configuring the classpath variable coz i've tried it!!!"
    so here the codes
    inhr.java:
    [code=java]
    package inherint;
    class inhr
    {
    int ssup;
    public int inht1;
    public int inht2;
    public int inht3;


    inhr(){}

    public inhr(inhr o)
    {
    inht1=o.inht1;
    inht2=o.inht2;
    inht3=o.inht3;
    }

    inhr(int i,int j,int k)
    {
    inht1=i;
    inht2=j;
    inht3=k;
    }
    void disp()
    {
    System.out.prin t("I am in Super class");
    System.out.prin tln("var values"+inht1+" "+inht2+" "+inht3);
    }
    }
    [/code]

    inher.java:
    [code=jave]
    package inherint;
    class inher extends inhr
    {
    int inh;
    int ssup;

    inher(int i,int j,int k,int l)
    {
    super(i,j,k);
    inh=l;
    }
    int display()
    {

    super.ssup=120;
    ssup=420;
    System.out.prin tln("iam super's mem"+ssup+" "+super.ssu p);
    System.out.prin tln("i'll get executed for the Extended class");

    return inh;
    }
    [/code]
    vdmn.java:
    [code=java]
    package inherint;
    class vdmn{
    public static void main(String args[])
    {
    inhr ob1=new inhr(20,30,40);
    inhr ob2=new inhr(ob1);


    ob1.disp();
    ob2.disp();
    inher ob11=new inher(200,300,4 00,500);
    ob11.disp();
    ob11.display();
    //ob1.display();

    }
    }[/code]
    Last edited by Nepomuk; Sep 24 '08, 06:21 PM. Reason: Please use [CODE] tags
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Originally posted by yulam4u
    "Please don't tell me about configuring the classpath variable coz i've tried it!!!"
    In that case, we'll probably not be able to help you, because it will be a classpath problem. But if you tell us, how you configured the classpath, we'll probably be able to figure out, what's not working.

    Oh, and please use [CODE] ... [/CODE] tags - they really help. Just look, I've added them to your post and it's much easier to read now.

    Greetings,
    Nepomuk (Moderator)

    Comment

    • yulam4u
      New Member
      • Sep 2008
      • 2

      #3
      Originally posted by Nepomuk
      In that case, we'll probably not be able to help you, because it will be a classpath problem. But if you tell us, how you configured the classpath, we'll probably be able to figure out, what's not working.

      Oh, and please use [CODE] ... [/CODE] tags - they really help. Just look, I've added them to your post and it's much easier to read now.

      Greetings,
      Nepomuk (Moderator)
      ya
      mayb u r right
      thanks for the reply


      well here is how i've done that
      Variablename: CLASSPATH

      VAriableValue: C:\shashikayubb i\inherint\

      or .;C:\shashikayu bbi\inherint\
      or .C:\shashikayub bi\inherint\


      which one is the correct way http://bytes.com/forum/images/icons/icon5.gif

      Remember "shashikayu bbi" is ma current working directory and the "inherint" is it's sub-dir that i am using as the package directory!!!

      Comment

      Working...