I have made a file A.java and another B.java. A and B are in the same folder. B has
A a = new A();
How do I import A to B ?
I am not using any ide. Running it on hadoop framework
No need of importing files. Just compile and run. As in the picture 1 you can you can compile both files and run the class with the main method . In my case my main method is in DogTest.java file in or You can just compile your java file which includes the main() method and run.
Classes that are in the same package do not need to import from other classes in the package, provided that the class isn't private. So in your case, you shouldn't need to worry about importing, as A is, by default, imported to B so long as A isn't private.
package test.abc;for secondpackage test.ab;Btw, if you use intellij, it has lots of package related bugs. But the code will compile and run.