Line Break or New Line : I hope you understand what it is, in HTML you use <br> tag to make a new line so in Java if you want to make a new line it's not that hard but it has several methods depends on the platform.
Coming to the point, most of the java beginners think this is the one and only way to make a new line : System.out.println("\n"); but It's not true.. let me tell you something you might think that whatever you program using java will work on other java supported platforms, YES! they will work on other platforms but there are few things that has to be changed in order to get the functions work.. for example this tutorial; this line of code : System.out.println("\n"); would make a new line only on Windows. As I said before there are few things that are different from platform to platforms.
If you want to make a new line on Mac you must use this : System.out.println("\r"); and for Linux you have to use this : System.out.println("\r\n");. So I came up with something that works on all the platforms, It's pretty simple and works perfectly.
First you need to make a public string and set the value to make a new line(You can also just make normal string and set the value)
Add this line of code before your main event
Whenever you need to make a new line just use this line of code
You can add this wherever you want to
Please comment if you have any doubts..!
Coming to the point, most of the java beginners think this is the one and only way to make a new line : System.out.println("\n"); but It's not true.. let me tell you something you might think that whatever you program using java will work on other java supported platforms, YES! they will work on other platforms but there are few things that has to be changed in order to get the functions work.. for example this tutorial; this line of code : System.out.println("\n"); would make a new line only on Windows. As I said before there are few things that are different from platform to platforms.
If you want to make a new line on Mac you must use this : System.out.println("\r"); and for Linux you have to use this : System.out.println("\r\n");. So I came up with something that works on all the platforms, It's pretty simple and works perfectly.
First you need to make a public string and set the value to make a new line(You can also just make normal string and set the value)
Add this line of code before your main event
public static String breakline = System.getProperty("line.separator");
Whenever you need to make a new line just use this line of code
You can add this wherever you want to
System.out.println(breakline);
Please comment if you have any doubts..!
60 comments
ReplyLooking for a career in technology industry? Wonder what are the languages that will give just the right start to your career?
Over to the hottest programming languages you can learn in 2015.
Corporate Training
The information you have deliver here is really useful to make my knowledge good. Thanks for your heavenly post. It is truly supportive for us and I have accumulated some essential data from this blog.
ReplyRegards,
sas training in Chennai|sas course in Chennai|sas training institute in Chennai
Hi, This is really nice blog. You have done really great job. Keep posting. I did Java Training in Chennai at TIS academy. Its really useful for me to make a bright future in IT industry.
ReplyThanks for sharing this niche useful informative post to our knowledge, Actually SAP is ERP software that can be used in many companies for their day to day business activities it has great scope in future.
ReplyRegards,
SAP training in chennai|SAP course in chennai|SAP Training in Chennai|sap training in Chennai
Awesome Post! I like writing style, how you describing the topics throughout the post. I hope many web reader will keep reading your post at the end, Thanks for sharing your view.
ReplyRegards,
Angularjs training in chennai|Angularjs training chennai|Angularjs course in chennai|Angularjs training center in Chennai
most useful information article,
Replygreat posting it author,
learn seo and complete digital marketing course with our best seo experts
seo training in bangalore
Dear admin, The way you have explained the concept is mezmerizing. Thank you so much for sharing tis worth able content with us. The concept taken here will be useful for my future programs and i will surely implement them in my study. Keep blogging article like this.
ReplyJAVA Training in Chennai | Best JAVA Training in Chennai | Android training in chennai
Hello,
ReplyThe great article on Java to Make a Line Break/New Line
Java Online Course | Java Training in Chennai | J2EE Training in Chennai
Great article.I learned some new concept. Thanks for sharing.
ReplyWeb designing training in chennai
Nice post..Software Testing Training in Chennai
ReplyReally great post thanks for fabulous sharing and also informative IOS Design And Development
ReplyThank you for sharing this knowledge in a blogpost.Really simple and even more effective and this worked great, very useful tips
Replyhttp://hadooptraininginhyderabad.co.in/salesforce-training-in-hyderabad/
Nice post. I learned new information, Thanks for sharing.
Replydigital marketing training institute in chennai
Your blog is really very informative and useful for us. Core Java Training | Oracle DBA Training | Dot Net Training
ReplyGreat article. Happy to visit your blog.
ReplyDigital Marketing Training Institute in Chennai
100% Job Oriented R Programming for more Information click to the best php training in chennai
Reply100% Job Oriented R Programming for more Information click to the best uml training in chennai
ReplyI gathered some needful information through your blog. Big Data Training | Oracle DBA Online Training | SQL Server DBA Online Training
ReplyGreat article. Happy to visit your blog.
ReplyI think this is a right place to begin my career successfully. because, here i found lots of best training institute in Bangalore. I believe that will give huge supports to me.
ReplyNice tutorial about java programming. Its very authenticate for fresh web developers They can learn huge things about Java from here.
Replycheap MLM software
Informative and useful blog post..
ReplySAP Training in Chennai | JAVA Training in Chennai
Highly useful blog post..
ReplyCCNA Training in Chennai | Networking Training in Chennai
Nice Post
ReplyThanks for giving such useful information about Java,
Dot net training institute in bangalore
Nice blog. If anyone interested to learn SAS Training visits GangBoard. We are the best provider of SAS Online Training | Data Science with R Training | Data Science with Python Training | Hadoop Training
ReplyGood information!! Really it will be more useful for the freshers. We are also one of the best sources to learn Selnium -Selenium testing training in Chennai | Best Selenium training center in Chennai
ReplyHello admin, Java is an object oriented language and you have shared new line break java concepts. It was really great. Continue sharing more new concepts like this.
ReplyRegards,
Spring Training in Chennai | Hibernate Training in Chennai | Struts Training in Chennai
Greatest article blogs posting!! One of the best useful blog We've noticed this particular subject information is good. find selenium jobs in hyderabad.
ReplyThanks to give such a useful information about JAVA Training in Bangalore
ReplyGreat article to share.Very nice to sharing the post.I appreciate your post.
ReplyBest Bcom/Mcom Project Center in Chennai | No.1 Bsc/Msc Projects in Chennai | Best BCA/MCA Project Center in Chennai
Very interesting and informative article to sharing the knowledge about the systems.keep rocking..
ReplyNo.1 Java Project Center in Chennai | Best Dot Net Projects in Chennai | Best Mini Project Center in Chennai
Great post.
ReplyIt really helped me to learn something new. So thanks.
Spring training in Bangalore.
Energetic information I got from this blog. Thanks to show me the real benefits of java programming. From here, I have realized that programming how is helpful to make mobile application. Web application projects
ReplyThanks to afford nice programming tutorial about java. I am not expect this information from your side. But, its really valuable to me. I never forget your good work.
Replyjava training center
Thanks for sharing this wonderful blog.. it helps me a lot. best informatica training in bangalore
ReplyThanks for sharing in this useful..its really awesome...
ReplyEmbedded system training in Chennai
PLC training in Chennai
plc, scada training in Ernakulam, Kerala
Ieee final year projects in chennai
Best plc training institute in Chennai
VLSI training in Chennai
PLC training institute in Chennai
PLC training Centre in Chennai
PLC training institute in Ernakulam
Embedded system training institute in Chennai
useful post for beginner java programmer it would improves programming logical thinking i am always eager to learn android application development Programming thus give bit more updates bout printing concepts thanks a lot.
Replyi have read your post very informative blogs for beginners keep sharing
Replyjava programming training
Best Salesforce Training in Hyderabad
ReplySalesforce Admin Training in Hyderabad
Salesforce Integration Training in Hyderabad
Your post is outstanding! thanks for such a post, its really going great work.
ReplyAngularJS Training in Chennai | AngularJS Training Institute in Chennai
Thanks for the blog and it is really very useful one.
ReplyAWS Training in Chennai
Innovative and useful. Thank you for information.Devops Training in Chennai
ReplyDevops Training in Bangalore
Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
Replyaws training institute in bangalore
This post is really really nice explained by professional manner,so thanks for your present here.
ReplyPython Training in Chennai
Python online training
Astounding post!!! Java is most well known and proficient programming dialect accessible in the market today. It encourages designers to make shocking work area/web applications stacked with staggering functionalities.
ReplyDevops Training Online
hello sir,
Replythanks for giving that type of information.
digital marketing company in delhi
Wow, Nice blog. Thank you so much for the efforts of this blog. Visit for
ReplyWebsite Development Company in Delhi
digital marketing company in delhi
ReplyPositive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.
ReplyRead more : R Programming institutes in Chennai | R Programming Training in Chennai
ReplyGreat efforts put it to find the list of articles which is very useful to know, Definitely will share the same to other forums. big data training in Velachery | Hadoop Training in Chennai | big data Hadoop training and certification in Chennai | Big data course fees
Thanks for Sharing...Nice Post!!!
ReplyPython Training in Chennai
Selenium Training in Chennai
Data Science Training in Chennai
AWS Training in Chennai
FSD Training in Chennai
MEAN Stack Training in Chennai
An interesting topic with great examples, keep updating your knowledge with us. Networking Course in Chennai
ReplyI’d love to be a part of group where I can get advice from other experienced people that share the same interest. If you have any recommendations, please let me know. Thank you.
ReplyAWS Training in Chennai
I am Here to Get Learn Good Stuff About DevOps, Thanks For Sharing
ReplyDevOps Training
DevOps Training institute in Ameerpet
DevOps Training institute in Hyderabad
DevOps Training Online
DevOps Training Institute
I read the post and I have really enjoyed your blogs posts. Looking for the next post.
ReplyAviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
Replylenovo service center
lenovo mobile service center near me
lenovo mobile service centre in chennai
Post a Comment
Note: Only a member of this blog may post a comment.