473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

package inheritance

17
hi,
"a1" and "a2" in different source file.
/* package p1;
class a1 . */

/* package p1
class a2 extends a1*/

when i compiled a2 source file i got error saying "unresolved symbol"

plz tell me what to do , where i went wrong ..

thank u
Feb 4 '07 #1
4 1242
r035198x
13,262 8TB
hi,
"a1" and "a2" in different source file.
/* package p1;
class a1 . */

/* package p1
class a2 extends a1*/

when i compiled a2 source file i got error saying "unresolved symbol"

plz tell me what to do , where i went wrong ..

thank u
You should compile a1 first.
Feb 5 '07 #2
hostel
17
You should compile a1 first.
a1 can be compiled without error when included package , but when i compile a2 including package name , then i get error saying "unresolved symbol". when i dont include package name then
they compile and run
Feb 5 '07 #3
dmjpro
2,476 2GB
plz send me the code...
then i can explain u clearly...
and one more thing , plz mention the jre environment and default classpath .................
send me my requirements i am online
thannnkkkkkkkkkkkkkkkkssssssssssssssssssssssssss
Feb 5 '07 #4
hostel
17
plz send me the code...
then i can explain u clearly...
and one more thing , plz mention the jre environment and default classpath .................
send me my requirements i am online
thannnkkkkkkkkkkkkkkkkssssssssssssssssssssssssss
//file name a1.java
package p1;
public class a1{
int a=1;
public int b=2;
private int c=4;
protected int d=3;
public a1()
{
System.out.println("a="+a+"b="+b+"c="+c+"d="+d);
}
}

//file name a2.java
package p1;
class a2 extends p1.a1
{
a2()
{
System.out.println("a="+a);
}
}

//file name demo.java
package p1;
public class demo
{
public static void main(String args[])
{
a1 ob1=new a1();
a2 ob2=new a2();
}
}

CLASSPATH
/bin/jdk1.6.0/bin/ //for jdk
/bin/jdk1.6.0/jre/lib/ //for runtime
.:/wind/javapgm/ //package p1(directory) exists in javapgm
Feb 8 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: G. Ralph Kuntz, MD | last post by:
Step on my soapbox... :-) I believe that the "final" keyword is underused in Java. I have gotten into the habit of using it on EVERY method parameter, instance variable, and local variable...
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
4
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
5
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
6
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
2
by: yulam4u | last post by:
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.