#Compiling multiple files from a single file
26 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
you do not have to compile first with javac, you can just do java Test.java and java will compile all files using javac for you and then run it
oh thats neat, thank you 😄
is there any term for this method?
?
but also if you want to compile manually first without running it, javac detects all used files and compiles them too. but you do not need to run javac first, just use java
I mean is this just called compiling or is there any other term for this... maybe I am overthinking?
java does compile it for you using javac and then runs the program, and since you usually want to run it there is no need to call javac manually
java does both steps at once
it has no term
you can call it compile and run
Okay, thank you ❤️
Closed the thread.
but what you can not do is importing from the default package
when you import something the classes you are importing have to be inside of a named package
by same package you mean under same dirctory? like my Test.java is in practice/ and Product.java should also be in practice/
i did not say anything about same package
i said classes you import have to be inside of a named package
you can import from different packages
but they can not be in the default package
default package is when there is no
package org.yourpackage.name;
at the top. when you have a package statement at the top it is inside of a named package, if not it is the default package
(it also has to be inside of according directories, every name seperated by a dot is a folder)
ok ok so If I did not specify any named pacakge on the file I cant use it in another file right?
correct
