Hello.
Why this doesn't work?
import java.lang.System;
out.println("Hola mundo");
Sorry I can't post the full code, but I'm on my cell phone.
Thank you very much.
Hello.
Why this doesn't work?
import java.lang.System;
out.println("Hola mundo");
Sorry I can't post the full code, but I'm on my cell phone.
Thank you very much.
Basically you have to reference which class the property belongs to
out
. No matter how much you import it, Java doesn't recognizeout
, so you'll have to do:If you want to simplify it you could do something like this:
You can do something pretty much the same as you want using static imports .
With static import, basically what you do is define a variable or method of another class so that it is called with syntax as if it were defined in the current class. In this case it
out
is an object of typePrintStream
and we use it as if it were a variable declared at the class level.Additionally I leave you a link with more information.