Link to complete Java tutorial with VoiceOver - http://bit.ly/1muxuWW
Here is the java program I used
// Program to create a package
import alpha.*;
class Package
{
public static void main(String args[])
{
classA a = new classA();
a.displayA();
classB b = new classB();
b.displayB();
}
}
// Codes for individual classes inside the alpha folder package
// the .class file of these classes must be placed inside the alpha folder
// for classA
package alpha;
public class classA
{
public void displayA()
{
System.out.println("This is classA.");
}
}
// for classB
package alpha;
public class classB
{
public void displayB()
{
System.out.println("This is classB.");
}
}
After opening command prompt, firstly we need to set the path of bin java directory, done by
set path="bin path here"
Then we change directory to where our program is located, by
cd JavaProgramPathHere
Then we have to compile classA and classB and put their .class files in a folder named alpha
We run
javac -d . classA.java classB.java
A new folder named alpha is created, and class file is directly sent there.
Now all we need to do is compile the main program, Package.java
Delete classA.java and classB.java if it throws up some errors.
Compile using javac Package.java
Run using java Package
Thats it guys..!
Refer the youtube video to know more and learn how to execute exactly :D
Link to full video course with voiceover - http://bit.ly/1muxuWW
En esta página del sitio puede ver el video en línea Java packages executed- How to import other java programs in a main program de Duración hora minuto segunda en buena calidad , que subió el usuario Themultiomniman 30 octubre 2014, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 23,242 veces y le gustó 53 a los espectadores. Disfruta viendo!