+ 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
3 ответов
+ 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.
+ 2
Thank you fair comraid
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