java package and import help
package pack;
class Zoo
{
public void displayMyName()
{
System.out.println("hi my name is Tara");
}
}
so i have written a programme like this and
compiled it as javac -d D:\practise\package\tara D:\Practise\Package\Zoo.java
here i have written the source file in Package and stored the class file inside tara directory
So now from where should i compile this code so that i can import this package
import pack;
class DemoImport
{
public static void main(String[] args)
{
Zoo a=new Zoo();
a.displayMyName();
}
}
so what is the mistake i have done please help
Re: java package and import help
Your package name has to reflect the file structure, and yours does not appear to do this.
Re: java package and import help
what is the mistake i have done please rectify it
Re: java package and import help
See my post in your other package thread, linking to the tutorial on packages.
Re: java package and import help
Lets keep this discussion in one place. Closing this thread.
db
THREAD CLOSED