How do I compile and run the following programs:
Test1.java:
package A; public class Test1 { public int a = 1; } Test2.java:
package B; import A.*; public class Test2 { public static void main(String [] args) { Test1 obj = new Test1(); System.out.println(obj.a); } } I'm new to packages. If I compile using javac *.java and manually create dir A, copy Test1.class into it and manually create dir B and copy Test2.class into it and then run java B.Test2 it works. I'm sure this is not the right way of doing it. Please suggest.