Wednesday, June 6, 2018

Technical Tip #16 - Technical Tip of the day....


T16: Knowledge Tip Of The Day....
What is System.out.println?
System.out.println is a Java statement that prints the argument passed, into the System.out which is generally stdout.
System – is a final class in java.lang package. As per javadoc, “…Among the facilities provided by the System class are standard input, standard output, and error output streams; access to externally defined properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array…“
out – is a static member field of System class and is of type PrintStream. Its access specifiers are public final. This gets instantiated during startup and gets mapped with standard output console of the host. This stream is open by itself immediately after its instantiation and ready to accept data.
println – is a method of PrintStream class. println prints the argument passed to the standard console and a newline. There are multiple println methods with different arguments (overloading). Every println makes a call to print method and adds a newline. print calls write() and the story goes on like that.
Static Import to Shorten System.out.println()
Sometimes it feel System.out.println is a long statement to print. static import may shorten it a bit but it is not recommended, because it results in poor readability. I am just using this situation to explain static import and avoid using it in the below scenario.
import static java.lang.System.out;
public class ShortSOP {
public static void main(String[] args) {
out.println("Hello, world");
}
}





Regards,
javabykiranhr1@gmail.com
#Java #Learn #Upgrade #Training #Classes #OnlineLecture #OnlineVideos #Pune
Follow On LinkedIn @ https://bit.ly/2J2MbvU   
Join Our Google Group @ https://bit.ly/2sjbIuq  
#Call Now to book your seat to JOIN Java Training @ 7219474925, eMail @ javabykiranhr1@gmail.com
#Visit us @ www.JavaByKiran.com
#Java #J2EE
#Core +#Advance + #Struts +#Hibernate + #Spring + #REST + #OCJP + #OCWCD + #Maven + #Junit + #Jquery #Ajax + #XML
#Spring Boot + CI and many more ..
#Selenium
#Complete #Java + #Selenium + #TestNg + #Jenkin + #Webdriver + #Cucumber +#Maven + #DataProvider + #Keyword + #Hybrid + #POM End to End integration #Jenkin #Maven #Testng and many more ..

#JavabyKiran #Expert #Training #BestInstitute #Java #Python #Selenium #Freshers #Professionals #IT #Software #Career #Interview #Jobs#Jobopening  #BestTrainingInstituteinPune #ITCourses  #OnlineVideo  #Pune

No comments:

Post a Comment