I am new to JAVA Coding (1 week).....but i have learned several languages before (c,c++,php.....etc)....anyhow i am having problem with importing using asterisk (*).......I will try to explain in the best way I can.........any help would be great.......thank you in advance.......
Create a main file find.java and create 3 other class files earth.java, mars.java. pluto.java. Run find.java and display the System.out.println from the all the files....
Avi Singh wrote:When using - import planets1.*; I am getting cannot locate earth class. However, when I use import planets1.earth; import planets1.mars; import planets1.pluto; The code works perfectly
When seeking help with an error, it always helps if you copy and paste the exact error text. There isn't a Java compiler or runtime error that would report
cannot locate earth class
Have you learned about constructors? They don't have a return type, not even void.
Edit: Sorry, that wasn't clear. What I meant was that it's bad form to have a method with the same name as a class.
Additionally, by convention Java class names start with an uppercase letter.
There are no new questions, but there may be new answers.
Joined: May 23, 2012
@ Darryl Burke
Thanks for the tips......i will keep it in mind during my next codes..........
Here is the exact error......
find.java:14: error: cannot access earth
earth e1 = new earth();
bad source file: .\earth.java
file does not contain class earth
Please remove or make sure it appears in the correct subdirectory of the sou
subject: Implicit Import is not working - import planets.*; not working.........