How to add classes in Java?
[deleted]
I have kept the Main class, but when i try to change the name I get a error. Also, if i try to add classes (And I keep the Main class) I get a error stating that I have a duplicate class, however, I do not have two classes called by the same name. I have tried googling the problem but all examples of the problem are to hard for me to understand as i have just started out with Java.
hayaodeh
hmmmm I don't know how to add classes in Java either 😞 but maybe other replers can help out. are you with us on our discord server?
AvoBolivar
How do you add another java file?
BlueDraconix
@AvoBolivar when adding a new file, have ".java" after the file name.
[deleted]
Thanks! I understand now how to add classes. Earlier I was a bit confused about the files, but I understand them now.
you can add a class in java by creating a separate java file and with the class you want to import in it. Then simply call the class it does not require the import function.
Here is an example:
https://repl.it/@paulfears/import-custom-class-java