Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 24th, 2008, 07:10 PM
Newbie
 
Join Date: Sep 2008
Posts: 2
Default 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 "shashikayubbi" , 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.print("I am in Super class");
System.out.println("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.println("iam super's mem"+ssup+" "+super.ssup);
System.out.println("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,400,500);
ob11.disp();
ob11.display();
//ob1.display();

}
}[/code]

Last edited by Nepomuk; September 24th, 2008 at 07:21 PM. Reason: Please use [CODE] tags
Reply
  #2  
Old September 24th, 2008, 07:25 PM
Nepomuk's Avatar
Moderator
 
Join Date: Aug 2007
Location: Germany
Age: 21
Posts: 1,817
Default

Quote:
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)
Reply
  #3  
Old September 25th, 2008, 05:42 PM
Newbie
 
Join Date: Sep 2008
Posts: 2
Question

Quote:
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:\shashikayubbi\inherint\

or .;C:\shashikayubbi\inherint\
or .C:\shashikayubbi\inherint\


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

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

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles