How to use the static import feature? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use the static import feature?

In my below code, the static import is used to access "System.out.print()" method as "out.print()". How to use it to access the method as "print()"? Also, how it works? https://code.sololearn.com/cvIbcO6nM2nQ/?ref=app

23rd Aug 2021, 2:52 AM
Rishi
Rishi - avatar
1 Answer
+ 2
I don't think you can because although System is class, out is a static instance. print method is not static so you need an instance like out.
23rd Aug 2021, 5:10 AM
你知道規則,我也是
你知道規則,我也是 - avatar