working with packages

hello.

i need help about packages.

Let me put a scenario to see if it's possible to do this.

on a root dir i have a java class that is from package A.

then on the same dir, but one level up i have dir B, all files in dir B are from package B.

file: a.java (package A)

dir B

b1.java (package B)

b2.java (package B)

My question is:

can i acess the methods and members from the dir B ? How ?

Thank you.

[473 byte] By [noe.rochaa] at [2007-11-26 16:20:22]
# 1

This won't work. classes that are in packages must be located in a directory tree that mirrors the package name. Fo for your example, it should be like this:

Root Dir

|--dir A

|--A.java

|--Dir B

|--B1.java

|--B2.java

that is your root dir has a sub dir called A, with a class a, and a sub dir B, which has the b! and B2 classes

the package statement would be

//for a.java

package A;

//for b1.java and b2.java

package A.B;

~Tim

Message was edited by:

SomeoneElse

to answer the access portion of the question

if you want to use the b1 or b2 classes in a, than in a, you need to do an import

import A.B.b1;

SomeoneElsea at 2007-7-8 22:43:57 > top of Java-index,Java Essentials,New To Java...