Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Packages

 
putti don
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have created a package by name P1 with two files in the package with a single class in each file. One of the class is a public class(say A). I want to inherit this class A into another class B, which is in the other file of the same package.But when i try to compile "B.java" i am getting error like cannot resolve symbol A.

Is it not possible to inherit a class of one file into another class of another file with both files being in the same package?

Thanks.
 
Arulkumar Gopalan
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is very much possible to inherit a public class from any package.

Here is your case:

You must compile with -d option. i.e.like
LocationOfYourJavaFiles$javac -d . *class.java
This would create appropriate directory and put the class files there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic