mercredi 15 juin 2016

Top 5 Books to Learn Concurrent Programming and Multithreading in Java - Best, Must Read

Books are very important to learn something new and despite being in the electronic age, where books have lost some shine to internet and blogs, I still read and recommend them to get a complete and authoritative knowledge on any topic e.g. concurrent programming. In this article, I will share five best books to learn concurrent programming in Java. These books cover basics, starting from how to create and start a thread, parallel programming, concurrency design patterns, an advantage of concurrency and of course pitfalls, issues, and problems introduced due to multithreading. learning concurrent programming is a difficult task, not even in Java but also on other languages like C++ or modern days JVM languages like Groovy, Scala, Closure, and JRuby.
Read more »
Share:
Read More

mardi 14 juin 2016

Unsupported major.minor version 52.0 in Java + Eclipse + Linux [Solution]

The "unsupported major.minor version 52.0" error started to come after Java SE 8 release and the root cause of this error is trying to run a Java application compiled with JDK 8 into a JRE lower than Java SE 8 e.g. JRE 7 or JRE 6. This is very common because a developer has updated their compiler or IDE to Java SE 8 but many times their runtime is not upgraded to Java 8. If you remember, in Java you can run a class file compiled with a lower version say Java 6 to a higher version say JRE 8 because Java is backward compatible but vice-versa is not allowed. This make sense because Java SE 8 has features like lambda expressions, method reference, functional interface and new Date and Time API, which lower version JRE has no information. Depending upon where you getting this error e.g. Eclipse, NetBeans, IntelliJ IDEA or Android Studio, the solution could be different. All these IDEs has different settings for JRE but the bottom line is same, you need to configure these IDE to use JRE 8 to run the Java program compiled using Java 8.
Read more »
Share:
Read More

lundi 13 juin 2016

How to add Primary key into a new or existing table in SQL Server

Since a primary key is nothing but a constraint you can use ALTER clause of SQL to add a primary key into existing table. Though it's an SQL and database best practice to always have a primary key in a table, many times you will find tables which don't have a primary key. Sometimes, this is due to lack of a column which is both NOT NULL and UNIQUE (constraint require to be a primary key) but other times purely due to lack of knowledge or lack of energy. If you don't have a column which can serve as primary key you can use identity columns for that purpose. Alternatively, you can also combine multiple columns to create a composite primary keys e.g. you can combine firstname and lastname to create a primary key name etc.
Read more »
Share:
Read More

samedi 11 juin 2016

5 Difference between BufferedReader and Scanner class in Java - Example

Even though both BufferedReader and Scanner can read a file or user input from command prompt in Java, there some significant differences between them. One of the main difference between BufferedReader and Scanner class is that former is meant to just read String while later is meant to both read and parse text data into Java primitive type e.g. int, short, float, double, and long. In other words, BufferedRedaer can only read String but Scanner can read both String and other data types like int, float, long, double, float etc. This functional difference drives several other differences on their usage. Another difference is Scanner is newer than BufferedReader, only introduced in Java 5, while BufferedReader is present in Java from JDK 1.1 version. This means, you have access to BufferedReader in almost all JDK version mainly Java 1.4 but Scanner is only available after Java 5.  This is also a popular core Java questions from interviews. Since many developer lack Java IO skill, questions like this test their knowledge about API and how to do some practical task.
Read more »
Share:
Read More

2 Books to Prepare Java EE 6 Web Component Developer Certified Expert 1Z0-899 Exam (OCEJWCD)

Oracle launched "Java EE 6 Web Component Developer Certified Expert 1Z0-899 Exam" in 2011 to replace "Java Platform, Enterprise Edition 6 Java Server Pages and Servlet Developer Certified Expert Exam" and the "Oracle Certified Expert, Java Platform, Enterprise Edition 6 Java Server Pages and Servlet Developer" certification. They are equivalent of plain old SCWCD exam of Sun Microsystems era. Frankly speaking, I always found sun naming less confusing and clearer than Oracle's e.g. SCJP was much better than OCAJP and OCPJP. Though this exam is based on your knowledge of Servlet and JSP as per Java EE 6 specification, any book which covers this two technology e.g. "Head First Servlet and JSP" is highly recommended because Servlets and JSP are not changed much except Servlet 3.0 specification, which you can prepare separately. Oracle also provides training and preparation material and you can also take help from commercial mock exam providers like Whizlabs and Enthuware.
Read more »
Share:
Read More

vendredi 10 juin 2016

12 Must Read Advance Java Books for Intermediate Programmers - Part 1

I often receive loads of email about Java book recommendations, something like, I have 2 years of experience, which Java book I should read to become an expert Java programmer, or I have 5 years of experience and want to become a Java expert, which books should I refer? It's interesting that most of the email I receive are not from beginners but from Java developers who has 2 to 3 years of experience. I call them Intermediate Java programmers, because they are in the state of their career where they know how to program in Java but they are not expert yet. They don't know how to write scalable, concurrent and robust code using Java concurrency features, they are learning design patterns but they are not yet using them in real code. They lack unit testing skills and they also don't have design skill a key for expert and senior Java developer. Keeping those things in mind, In this three part series of Java book recommendation article, I'll share 10 to 12 books to develop skills which both an intermediate and advanced Java developer should have.
Read more »
Share:
Read More

jeudi 9 juin 2016

How to Remove Duplicate Characters from String in Java

This week's coding exercise is to remove duplicate characters from String in Java. For example, if given String is "aaaaaa" then output should be "a", because rest of  the "a" are duplicates. Similarly, if the input is "abcd" then output should also be "abcd" because there is no duplicate character in this String.  By the way, you can not use any third-party library or Java API method to solve this problem, you need to develop your own logic or algorithm and then write code to implement that algorithm. This is one of the interesting problems from Java coding interviews and you can use this program to weed out Java programmers who cannot write code. This problem is much better than Fizzbuzz because it requires more logic and coding than solving Fizzbuzz.
Read more »
Share:
Read More