Tuesday, November 28, 2017

Read a text file in only one line of Java code

Since Java 7, you can do this with this wonderfull line :

new String(Files.readAllBytes(Paths.get(this.getClass().getResource("/file.txt").toURI())))

That makes Java powerfull and I love that.

3 comments:

raj kumar said...

Looking very good blog. I am so thankful to you and expecting more info on Core Java and please do keep sharing on...
Thank you so much

Shailendra said...

Wow, very nice blog. I like it. thanks for sharing helpful post.
JAVA Training in Gurgaon | JAVA Training Institute in Gurgaon

sathyaramesh said...

I am really enjoying reading your well-written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
Hadoop Training in Chennai
Big Data Training in Chennai
Selenium Training in Chennai
Software Testing Training in Chennai
Java Training in Chennai
big data training in chennai anna nagar
hadoop training in Velachery

Display Javascript console logs with jsfiddle

Jsfiddle is mainly made to test javascript code in a web context (aka with HTML and CSS). But, if you just want to use is to test backend c...