HTML

How to lock a File before writing in Java? Example

A file is one of the oldest ways to store data and share data but if you are working in a shared file i.e a file which can be read or write by multiple readers and writers, you need to make sure that the file is locked before you try to write on it. This is needed to ensure that someone doesn't overwrite the data you are writing. Fortunately, Java provides a mechanism to lock a file before writing using the FileLock interface. You can get the handle of FileLock by using FileChannel for writing to a file. The FileChannel class is generally used to write faster in the large file and one of the common way to write binary data in Java.

10 Important points about String in Java

someone might question that why do we need another article about string in Java, haven't we had enough about the string is already written? Yes, I agree there are a lot of articles related to Java string covering topics like how to use Java String, an example of Java string and almost everything you can do with string in Java. But, I wanted to document my experience of using String in Java and some nasty and little-known things I discovered about the Java String class, which may not be obvious to many Java developers. A string is available in almost every programming language and its probably the most used data structure or a data type, hence a good knowledge of String is very important for every Java developers.

JDBC - How to get Row and Column Count from ResultSet in Java

One of the common problem in JDBC is that there is no way to get the total number of records returned by an SQL query. When you execute a Statement, PreparedStatement, or CallableStatement using execute()or executeQuery() they return ResultSet and it doesn't have any method to return the total number of records it is holding. The only way to find the total number of records is keeping the count while you are iterating over ResultSet while fetching the result. This way, you can print the total number of rows returned the SQL query but only after you have processed all records and not before, which may not be the right way and incur significant performance cost if the query returns a large number of rows.

Effective Java 3rd Edition by Joshua Bloch – Book Every Java Developer Should Read in 2018

Hello guys, you might have heard about it that Effective Java 3rd Edition is finally available. After 10 years of the long wait by Java programmers from all over the world, finally, an updated version of, probably the most popular Java book on the planet is released now. This new version covers the features and paradigm introduced in JDK 7, 8, and 9.  Joshua Bloch has done a great job in also updating most of the items to keep it relevant to the newer version. Apart from that, there is a whole new chapter added to explain best practices around Java 8 features. I know you don't need any reason to read this book, given its huge popularity and acceptance. Many startups which use Java,  particularly in India, are also distributing copies of this book as a New Year Gift.

Top 10 Web, Mobile, and Big Data Technologies Programmers should learn in 2018

Hello Guys, we are already in the second week of 2018 now and many of you have made your goals about what to learn in 2018, but if you haven't then you have come to the right place. In this article, I am sharing some of the best framework and libraries for web development, mobile app development, and big data, an application developer can learn in 2018. The New Year will be all about the mobile and next-generation web with a greater focus on big data technologies like Hadoop and Spark, but you can still learn the popular Java and Web development frameworks like React, Node.js, Spring Boot to take your career to next level. These frameworks are tried and tested and will be here for at least next 5 years to come.