java - Problem in System.out.println statement -
Whenever we write a statement to print to console in the Java program:
System.out.print
or System.out.println
Above both methods, we explicitly reference the contents of the printstream object to the java.io package If we are calling without import, then how are we reaching those objective methods without error in any compilation?
In the system object, java.io.pr IntStream
embedded in objects so you do not need to import obviously - Runtime can achieve this information as it was properly embedded at compile time.
As you have identified, if you have used a printstream
object directly, you have to import this compilation phase does not know where it is (it < / Em> can search, but it can easily give ambiguous results).
Note also (if there is any confusion) is imported on java.lang
, so you do not need an import statement for system
Comments
Post a Comment