5 Difference between Constructor and Static Factory method in Java- Pros and Cons

The common way to create objects in Java is by using public constructors. A class provides public constructor e.g. java.lang.String so anyone can create an instance of String class to use in their application, but, there is another technique which can be used to create objects in Java and every experienced Java programmer should know about it. A class can provide a public static factory method which can return an instance of the class e.g. HashMap.newInstance(). The factory method is a smart way to create objects in Java and provides several advantages over the traditional approach of creating objects using constructors in Java. It can also improve the quality of code by making the code more readable, less coupled, and improves performance by caching.

Top 5 JavaScript Books to Learn - Best of Lot, Must Read

The JavaScript is the most popular programming language in Web, way ahead of popular ones like Perl, Ruby, and Python. It is also one of the essential skill for any Web developer. It is even true for Java developers. If you have JavaScript in your resume or LinkedIn profile, you will likely receive many Job opportunities. Everybody wants polyglots, programmers who know multiple programming languages because most of the real world projects are developed with multiple technologies, you will always found some component is written in Java, some in C++ then you have JSP, Server, jQuery, JavaScript etc for web pages and so on. In short, it's very important to learn JavaScript in today's competitive world.

10 points about volatile modifier or field in Java

The volatile modifier has always been an interesting and tricky topic to many Java programmers. I still feel that it's one of the most underutilized modifiers in Java, which can do a lot of good if understood and applied correctly, after all, it provides a lock-free way to achieve synchronization in Java. If a field is shared between multiple threads and one of them change its value i.e. one thread reads from the field which is written by other threads, then, by using a volatile modifier, you can synchronize access to this field. The volatile modifier in Java provides visibility and ordering guarantee without any locking. You might know that compiler and JVM can re-order your code due to various reasons e.g. performance improvement which can be a problem in concurrent Java application.