What is wrong with this Java file? (solved) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is wrong with this Java file? (solved)

I want to link multiple files so that I can make larger programmes but I seem to be making errors. I know this isn't a thing in solo learn but hopefully people here know what I'm doing wrong in linking these two files? https://code.sololearn.com/c7ILNOcrUhl2/?ref=app

23rd Oct 2020, 4:14 AM
Cam UOR
Cam UOR - avatar
3 Answers
+ 4
You need to import the class path of the class you are trying to use in that file. For instance in your file with the main method, after the package name, add; import multiple.snd; FYI, as a convention package names are lowercase in Java and class names start with an uppercase letter (mixed case). https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html Also, take care to use the proper access modifiers for your classes and methods etc.
23rd Oct 2020, 4:30 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Thank you fair comraid
23rd Oct 2020, 4:32 AM
Cam UOR
Cam UOR - avatar
0
package has to be at the first line of source code, and it needs an appropriate directory structure. Sololearn doesn't support it, and your code works without it
23rd Oct 2020, 6:02 AM
zemiak