+ 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