HTML

Top 5 Free Core Spring, Spring MVC, and Spring Boot Courses for Beginners to learn Online

I have been sharing a lot of resources e.g. books and courses recently and when I published my list of Top 5 courses to learn Spring and Hibernate, many of my readers asked about a similar list of free courses to learn Spring Framework e.g. Core Spring, Spring MVC, Spring Security, and Spring Boot. That request was always back of my mind but I couldn't get time to put together a list, which I can share with you guys, but today is the day. In this list, I have compiled some of the best online free courses to learn Spring Framework from scratch, online at your own pace. You can not only learn core Spring e.g. a framework which provides dependency injection, but also Spring MVC, the most important framework for a Java Web Developer, Spring Security, and Spring Boot to take your career to next level.

What is the cost of Oracle Java Certifications - OCAJP8, OCPJP8, OCEWCD, OCMJEA?

One of the frequently asked questions about Oracle Java certifications, formerly known as Sun Certified Java programmer e.g. OCAJP, OCPJP, OCEWCD, OCMEJA etc is about the cost of certification. Many of my readers often ask what is the cost of OCAJP8 or OCPJP8? Is there any discount available? What are the fees of Java 8 certifications? how much Java architect exam cost? etc. I have answered many of them one to one via Facebook and Email in the past, but after so many such requests, I decided to write a blog post about it.

Difference between OCAJP and OCPJP Certification Exams

Earlier when Sun Microsystems was in charge of Java, the popular Java certifications were called "Sun Certified Java Programmer" or "SCJP" and that time there was just one exam, you need to pass to become a certified Java Developer, but when Oracle took over Sun Microsystems on 2010, the SCJP goes away and OCAJP and OCPJP born. Since Oracle already has his certifications for database administrations e.g. OCA which stands for Oracle certified associates and OCP, which stands for Oracle Certified Professional, it introduces new Java certifications to match their existing hierarchy and they are known as OCAJP and OCPJP in the Java world.

Java 8 - Convert ArrayList to HashMap or LinkedHashMap - Example Tutorial

One of the common task in Java is to convert a List of object e.g. List<T> into a Map e.g. Map<K, V>, where K is some property of the object and V is the actual object. For example, suppose you have a List<Order> and you want to convert it into a Map e.g. Map<OrderId, Order>, how do you that? Well, the simplest way to achieve this is iterating over List and add each element to the Map by extracting keys and using the actual element as an object. This is exactly many of us do it in pre-Java 8 world but JDK 8 has made it even simpler. In Java 8, you can get the stream from List and then collect all elements into a Map by using a Collector. The collect() method of Stream class and java.util.stream.Collectors class gives you ample choices to decide which property goes into the key and which object goes into the value.

Difference between first level and second level cache in Hibernate

The main difference between first level and second level cache in Hibernate is that the first level is maintained at the Session level and accessible only to the Session, while the second level cache is maintained at the SessionFactory level and available to all Sessions. This means, you can use the first level cache to store local data i.e. the data which is needed by the Session and you can use the second level cache to store global data i.e. something which can be shared across sessions. This is also one of the frequently asked Hibernate Interview questions and popular in both telephonic rounds as well as on face to face interview, in both fresher and experienced level interviews.

5 Best Gifts for Programmers,Software Developers and Tech Geeks 2017 - 2018

So, its that time of the year again when you start thinking about gifts for your programmer boyfriend, husband, colleagues or your near dear ones. Even if selecting gifts were not tough, if your friend happened to be a programmer, it becomes slightly tougher. You might have heard that Programmers are aloof, nerd and tech freaks, well, you heard it right. Programmers  prefers to be alone in their own world but they also like gifts and you got it right, they are a nerd so they like books, gadgets, music and something which help them to learn something e.g. a PluralSight membership.

In 2017, gadgets like Apple Watch and Samsung Gear is rocking but that's what everyone is buying so if you want to be a little bit different, chose the one from this list.

How to test RESTful Web Services using curl command in Linux

The curl command of Linux is very powerful and versatile command which allows you to send sophisticated HTTP request right from Linux command line. You can use curl to test your RESTful Web Services by sending GET and POST request, doing authentication, saving a cookie in the file etc. The curl command is the go-to tool for many Java and Spring developers for consuming the secured RESTful Web Services, but you can also use it test your simple REST Web APIs without security.

3 ways to convert String to byte array in Java - Example Tutorial

Today, I am going to discuss one of the common tasks for programmers, converting a String to a byte array. You need to do that for multiple reasons e.g. for saving content to a file, sending over a network or maybe some other reason. Suppose you have a String "abcd" and you want to convert it into a byte array, how will you do that in a Java program? Remember, String is made of the char array, so it involves character to byte conversion, which is subject to character encoding intricacies. Thankfully, Java provides a convenient getBytes() method to convert String to byte array in Java, but unfortunately, many developers don't use it correctly. Almost 70% of the code I have reviewed uses getBytes() without character encoding, leaving it on the chance that platform's default character encoding will be same as of the source String.

How to convert primitive int value to a Long object in Java?

Suppose you have an int variable but the part of the application is expecting a Long object, how do you convert a primitive int to a Long object in Java? It shouldn't be a problem, right? after all long is a bigger data type than int, so all int values are acceptable as long, but we also need a Long object, not just the long primitive value. Now, the problem is reduced to converting a long primitive to Long object, which is not really a problem if you are running on JRE version higher than Java 5. But, sometimes autoboxing is not efficient e.g. when you have to convert multiple long values into the Long object in a loop. A better way to convert your long primitive to the Long object is by using static factory methods like Long.valueOf(long l), which was originally meant to convert long primitive values to a Long object, prior to Java 5, but, also works fine with int primitive.

How to convert comma separated String to ArrayList in Java - Example Tutorial

Suppose you have a comma separated list of String e.g. "Samsung, Apple, Sony, Google, Microsoft, Amazon" and you want to convert it into an ArrayList containing all String elements e.g. Samsung, Apple, Google etc. How do you do that? Well, Java doesn't provide any such constructor or factory method to create ArrayList from delimited String, but you can use String.split() method and Arrays.asList() method together to create an ArrayList from any delimited String, not just comma separated one. All you need to do is first split the given String on delimiter e.g. comma using the split() method, this will give you an array of String. Now, you can pass that array to Arrays.asList() method to create a List, but remember this would be fixed length list and not truly an ArrayList.

How to create ConcurrentHashSet from ConcurrentHashMap in Java 8 - Example Tutorial

There is no ConcurrentHashSet in JDK 8 but you can still create one for yourself by using the ConcurrentHashMap class of java.util.concurrent package. There is a new method added into ConcurrentHashMap in JDK 8, newKeySet(), which allows you to create a concurrent hash set backed by a concurrent hash map. If you remember whenever you get keys from the map they are returned in a Set e.g. for the old keySet() method because map only has unique keys. Since map doesn't allow duplicate keys, it can be used as a set, as long as you only care for keys or just one element. That's why Java designers are added newKeySet() method to convert a map to set. This is also a static method, which means you don't need a ConcurrentHashMap object to create a concurrent hash set.

Top 10 Java HashMap Interview Questions and Answers

The java.util.HashMap is one of the workhorses of JDK. Along with ArrayList, it is one of the most used classes from Java's collection framework. There is hardly a real world Java project, where I haven't seen the use of HashMap. It is an implementation of hash table data structure and it's not a surprise that HashMap is so useful, as someone has rightly said, "if you could have just one data structure, make it a hash table". The hash table data structure allows you to search for a value in O(1) time if you have key. In Java, there are several implementations of hash table data structure exists e.g. Hashtable, ConcurrentHashMap, LinkedHashMap etc but HashMap is your general purpose map. Though, if you have a special need you can use other hash table implementations available in JDK.

5 Free SQL Books For Beginners and Experienced - Download PDF or Read Online

There is no doubt that SQL is one of the most important skills for both programmers and business analyst. Since many Enterprise applications use the relational database at their backend e.g. Oracle, Microsoft SQL Server, MySQL, it's important to know SQL to work with data resided on those databases. SQL has been around for many years and it will be around for many more coming years. It is also one of the matured technology, hence there are a lot of free resources e.g. books, articles, tutorials are available online.   I have been sharing some free eBooks on different technologies e.g. Java, Python, and jQuery and today I'll share some of the free SQL books for online and offline reading.

Java 8 Default Methods FAQ - Frequently asked Questions and Answers

In last a couple of articles, I have to talk about default methods introduced in JDK 8. First, we have learned what is default method and why it is introduced in Java. Then we have seen the example of how you can use default methods to evolve your interface. After that we have analyzed does Java really support multiple inheritances now in JDK 8 (see here) and how will Java handle the diamond problem that will arise due to default methods. For example, what will happen if a class extend a class and implement an interface and both contain a concrete method with same method signature? Will a diamond problem arise? How will Java handle that and how you can solve it, and the difference between abstract class and interface in Java 8?  Once you went through those articles, you would have a good knowledge of default methods in Java 8.

Default Methods in Interface, Multiple Inheritance and Diamond Problem in Java 8

Ever since Java 8 introduced default and static methods in JDK 8, it's become possible to define non-abstract methods in interfaces and since in Java one class can implement multiple interfaces and because there can be concrete methods in interfaces, the diamond problem surfaced again. What will happen if two interface has methods o the same name and a Java class inherit from it? Many Java programmer also asks me the question that, is Java 8 is also supporting multiple inheritances of classes, as it seems because interface with methods is similar to abstract class or in that any class. Well, it’s not.

Java 8 Default Methods On Interface : What, Why and Example

Whenever someone talks about Java 8, the first thing he speaks about is lambda expression and How lambda expression will change the way you use Collections API today. In truth, lambda expression would not be that useful had language not been enhanced to support default methods on Java Interface. Also known as a virtual extension or defender methods, they allow you to declare a non-abstract method inside Java interface. Which means, finally you can add new methods without breaking all classes, which implements a certain interface. This opens a new path for enhancing and evolving existing Collection API to take advantage of lambda expressions. For example, now you can iterate over all elements of Collection in just one line, as opposed to four lines it requires you to do prior to Java 8.

Difference between Abstract class and Interface in Java 8 with Default Methods

Ever since JDK 8 has allowed concrete methods on interface e.g. default and static methods, many of my readers have asked me how should they answer the classical abstract class vs interface questions. In this post, I'll revisit this hugely popular Java interview question in light of Java 8 changes. Before JDK 8, the level of abstraction was the clear cut difference between abstract class and interface i.e. interface was the purest form of abstraction which only define what interface is supposed to do without specifying how i.e. it only declare API methods and leave implementation to its subclasses.  All methods of an interface were abstract but since Java 8 you can define non-abstract methods in form of default and static methods inside interface in Java.

Top 5 Free Spring Certification Mock Exams and Practice Questions

Many Java developers don't know that similar to Oracle's Java certification, there is also a Spring certification program, which certifies yourself for your Spring framework skill. There are three Spring certifications currently available, Spring Professional certification exam, which certifies on your general knowledge about Spring framework, Spring Web Application Developer exam, which certifies you about your Spring MVC skill and Spring Enterprise Integration Specialist certification exam, which is for advanced Spring Integration skill. Earlier, SpringSource provides this company but now they are provided by Pivotal, the company behind Spring framework.

7 Free 1Z0-803 and 1Z0-804 Sample Questions - OCAJP 7 and OCPJP 7 Mock Exams (Oracle Certified Associate Java SE 7 Programmer 1 and 2 )

In this article, I am going to share some OCAJP 7 or 1Z0-803 exam and OCPJP 7 or 1Z0-804 certification sample questions and mock exam for practice which are completely free and available online. The sample questions are not good enough for thorough practice but you can use these mock tests to get an idea of what to expect in the actual exam. Many of the free mock questions are actually the samples questions provided by professional certification exam simulator provided e.g. Whizlabs, Enthuware, MyExamCloud etc, which are samples of their full-length exam simulators. As I have said many times in this blog that in order to succeed and do well on Java certification you must need a good study guide and a good exam simulator to practice well.

How to backup and load crontab from a file in Linux and UNIX

If you have been using Linux for some time then you might know about cron jobs. They are the scheduler which is used to automatically start processes in a Linux box. I have worked in many projects which use cron jobs to start the environment daily or weekly. They are similar to Autosys when it comes to scheduling job but cron is a Linux command as opposed to Autosys which is separate application altogether. In Linux, crontab command is used for loading cron jobs from a file, listing existing cron entries, and editing them. It manages the cron table that is used by the cron daemon in Linux to execute the cron jobs. Though there are comments to view cron jobs, edit cron jobs and upload cron jobs from a file there is no command to backup existing cron jobs, but don't worry, I'll show you a trick to backup your cron job before editing them or loading a new set of cron jobs.

How to find large files with size in Linux? find and du command example

One of the common problem while working in UNIX is to find large files to free some space. Suppose, your file system is full and you are receiving an alert to remove spaces or if your host is run out of space and your server is not starting up, the first thing you do is find top 10 largest files and see if you can delete them. Usually, old files, large Java heap dumb are good candidates for removal and freeing up some space. If you are running Java application e.g. core java based programs or web application running on Tomcat then you can remove those heap dump files and free some space, but the big question is how do you find those? How do you know the size of the biggest file in your file system, especially if you don't know which directory it is? We'll try to find answers for some of those questions in this article.

Top 10 Java Date, Time and Calendar Interview Questions Answers

The Date and Time API is very important one for day to day Java development work but many interviewers don't ask enough questions on this topic. Most of the questions are based on either Java Collection framework e.g. HashMap, ConcurrentHashMap or ArrayList, or on multi-threading concepts e.g. volatile, synchronized and atomic variables. This is not good and I think many interviewers have realized that a good understanding of date and time API is also important for a good Java developer. That's the main reason of increasing number of date, time and calendar based Java interview questions in recent time, particularly in 2017.

How to determine if a string has all unique characters in Java?

This is one of the common string based coding problem from programming job interviews. You need to write a program to determine if a given string has all unique characters or not. For example input= "Java" then your function should return false because all characters are not unique, and if the input is "Python" then your program should return true because all characters in Python are unique. For the purpose of this problem, you can assume the given String only contains ASCII printable characters, though you should always verify that with the interviewer. You can also assume that your solution needs to case-sensitive i.e. "P" and "p" will be considered two different characters and a string containing a letter in both capital and the small case will be considered unique. You are also free to solve the problem in place of using any additional data structure.

Top 17 SQL and UNIX Interview Questions for Software Support Engineers

The SQL and UNIX are two of the most essential skill for any support or development job. It doesn't matter whether you are applying for Java developer or C++ developer, Python developer or Ruby programmer, SQL and UNIX always have some role to play. Hence, it's imperative for any programmer to prepare both SQL and UNIX well before going for any job interview. This becomes even more important if you are going for a support engineer role. Since the main job of support professional is to look after production environment, which often runs on Linux, it's must for them to have a good knowledge of both Linux operating system and command line. They should know what they are doing because an incorrect grep or rm command can bring down the whole production system. That's why they are extensively questioned and tested in their UNIX skill.

5 ways to redirect a web page using JavaScript and jQuery

When an HTTP request for one page automatically goes to another page then it is called a redirection. The redirection of a web page is used for different reasons e.g. redirecting to a different domain e.g. when you move your website from one URL to another URL or redirecting to a more recent version of a page you are looking at it. There are many ways to redirect a web page and different web technologies provide different ways e.g. Java provides sendRedirect() and forward() method for redirection. The redirection can also be divided into two categories, client side and server side. In client side, redirection client is responsible for routing request to another URL but in server side redirection, its server's job to redirect to a new page.

How to find all files containing specific text in Linux? Use grep command

One of the most common task while working in programming projects is finding files containing some specific text e.g. you have your application deployed in Linux server and you are migrating your database from one server to another. Now, you want to file all config files and scripts which are referencing your old database using the hostname or IP address, so that you can replace them with an alias. Well, you should always use an alias to connect to the database or any other system, but sometimes it happens you have to use hostname. Anyway, how do you find all those files containing hostname in your Linux machine? Well, the grep command is here to help you.

String Rotation in Java - Write a Program to check if strings are rotations of each other or not

String based algorithmic questions are very popular in Java interviews e.g. checking if two String is the anagram of each other (see), or checking if given String is a palindrome (see), or just finding permutations of given String (see). One of such popular String based interview questions is about to check if two Strings are a rotation of each other in Java. In order to solve this question, you should know what is String rotation? Well, A string is made of characters and you just rotate the String around any character e.g. "programming" will become "ingprogramm" if we rotate the String on trailing character 3 times. A k-rotation on a string takes the trailing k characters of the string and attaches it to the beginning of the string in the same order. You can rotate the String either in the clock wise (right from the top) or anti-clockwise(left from the top). The string can also be rotated in one go e.g. "123456" will become "456123" if we rotate 456 to the left around character "3".

3 Spring Certification Books - Best of Lot, Must Read

Books, Study guides, and mock exams are some of the important resources to prepare for Spring certifications. In the last article, I have shared some of the best Spring certification guides for Spring Core and Spring web certifications and today I'll share some of the best books to learn Spring frameworks from the certification perspective. If you are preparing for Spring certifications then these books will help you to learn Spring better. It's also true that more and more experienced and intermediate Java developers have started preparing for Spring certifications to make themselves more marketable. In a challenging and competitive environment like today's, Spring is one the essential skills for Java developer. The Spring certifications make you valuable in the eye of employers and help you to get both job and career growth.

How to Sort Map by values in Java 8 using Lambdas and Stream - Example Tutorial

In past, I have shown you how to sort a HashMap by values in Java, but that was using traditional techniques of pre-Java 8 world. Now the time has changed and Java has evolved into a programming language which also has the power of functional programming. How can you take advantage of that fact to do your day to day task e.g. how do you sort a Map by values in Java using lambda expressions and Stream API. That's what you are going to learn in this article. It will serve two purposes, first, it will tell you a new way to sort a Map by values in Java, and, second and more important it will introduce you to essential Java 8 features like lambda expression and streams.

Top 5 Spring Certification Study Guides for Core, Web, and Enterprise Integration Exams

Ever since Pivotal has announced that Spring training is not mandatory for becoming Pivotal certified Spring developer, more and more experienced Java programmers, who have been using Spring for years are preparing for the exam. This is obvious because the expensive Spring training, which cost around 32000 USD in the USA and most of the western nations and around 50,000 INR in India was the biggest hurdle on getting Spring certified. Even though training is the best way to prepare for certification because it is totally focused on certification exam and you will cover all topics there, it is not affordable for most of the Java developers around the world. Now, the cost of Spring certification has just reduced to 200 USD from the whopping 3200 USD it cost earlier.

Can you make an abstract class/method final in Java?

No, you cannot make an abstract class or method final in Java because abstract and final are the mutual exclusive concept. An abstract class is incomplete and can only be instantiated by extending a concrete class and implementing all abstract methods, while a final class is considered as complete and cannot be extended further. This means when you make an abstract class final, it cannot be extended hence it cannot be used and that's why Java compiler throws a compile time error when you try to make an abstract class final in Java. In short, an abstract class cannot be final in Java, using both abstract and final modifier with a class is illegal in Java.

Solving org.springframework.beans.factory.BeanCreationException: Error creating bean with name X [Java Spring]

If you are using Spring framework in your Java application and getting this error during startup it means Spring is not able to initialize the bean X and add into its application context, Why? There could be multiple reasons e.g. a typo on spring bean name. Let's take a closer look at the stack trace to find out the real reason:

BeanInstantiationException: Could not instantiate bean class [X]: No default constructor found; nested exception is java.lang.NoSuchMethodException: X.()

Here X is the class, which is declared as Spring bean. The error clearly says that default constructor is not present in class X. By default, Spring will try to instantiate beans by calling the default or no-argument constructor and if it doesn't find the default, no-argument constructor then it is not able to initialize the bean and hence it throws the BeanInstantiationException during startup, the real reason is also appended into stack trace as NoSuchMethodException.

Grep Command example to List only Filenames with Matching String in Linux

The grep command from Linux is one of the powerful commands to find files containing some text, but when you use grep it not only print the file name but also the line which is containing the matching text. This is ok for most of the situations but sometimes you only want to grep to show filename and line and not the matching text e.g. when you are searching for some configuration e.g. database hostname across all configuration files in your application host. Since many files contain the database references, it's possible that you might get a lot of data on output, so if you are only interested in all the files containing matching text, you can use grep -l option. This option of grep only shows filenames which contain matching text.

How to sort an ArrayList of Objects using Comparator in Java 8 - Ascending and Descending Order

There are a lot of examples of Sorting ArrayList in Java on the internet, but most of them use either String or Integer objects to explain sorting, which is not enough, because in real world you may have to sort a list of custom objects e.g. your domain or business objects like Employee, Book, Order, Trade etc. In order to sort an ArrayList of objects, you need two things, first a class to provider ordering and a method to provide sorting. If you know about ordering and sorting in Java then you know that Comparable and Comparator class is used to provide the ordering for objects. The Comparable interface provides natural order e.g. lexicographic order of String or name for Employees, while Comparator is used to provide custom order. It gives you the flexibility to sort your objects on the parameter you want e.g. you can sort a list of Coupon objects on the percentage discount, expiry dates, or based upon the total cost.

How to Prevent Browsers from Caching Static Contents using Spring MVC Framework

One of the common requirement in a secure Java web application is to disallow back button of browser or invalid the session if the user hit the back button of the browser. You might have seen this behavior while doing online banking or net banking, almost all the banks don't allow you to use the browser's back button. Your session gets terminated as soon as you hit the back button and you have to log in again to do any transaction. Btw, Have you ever checked some situation on your Java web application like, if you pressed the back button of your browser after logging in, what happened? You will find that browser takes you to the previous page. This happens because your browser usually doesn't send another GET request to the server. Instead, it views the web page from locally cached responses. This is called browser caching/HTTP caching, it could happen not only on a login page but on any page. This behavior is actually controlled by the Cache-Control header of HTTP response.

How to Remove Entry (key/value) from HashMap while Iterating? Example Tutorial

Can you remove a key while iterating over HashMap in Java? This is one of the interesting interview questions as well as a common problem Java developer face while writing code using HashMap. Some programmer will say No, you cannot remove elements from HashMap while iterating over it. This will fail fast and throw concurrent modification exception. They are right but not completely. It's true that the iterator of HashMap is a fail-fast iterator but you can still remove elements from HashMap while iterating by using Iterator's remove() method. This is the same technique which we have used in past to remove elements while iterating over a List in Java. The key here is not to use the remove() method from Map or List interface to avoid java.util.ConcurrentModfiicationException in Java.

Top 40 Advanced Java/J2EE Interview Questions Answers for Experienced - 3 to 5 Years

I have shared many posts about Java interview question in the past but nothing, particularly for support engineer perspective. Since there are a lot of L1 and L2 support job exists in BFSI (Banking, Finance, and Insurance Industry) and they are also for the longer term, I decided to write this post. When you go for a support engineer role, especially for Java application be it to core Java or Java EE application, Interviewer expects you know basics of Java and can start/stop the application, see log files, alert developers, and other aspects of the support e.g. opening conference bridge to solve production issues, communicating to stakeholders, and involving right peoples. In this article, I will share questions to help with technical aspects e.g. the essential skills you need to clear a support engineer interview.

5 Difference between an array and linked list in Java

The difference between an array and linked list is one of the frequently asked data structure and algorithm interview question and you might have seen it before on your telephonic or face-to-face interview. It is also very popular question during practical exams on Computer Science degree courses e.g. B.E. and B.Tech. It's very simple and easy to answer but you just can't afford to miss this question on an interview. Both array and linked list are two of the most popular and fundamental data structure in Computer Science and Programming, and Java supports both of them. One of the traits of a good programmer is extensive knowledge of data structure and algorithm and that's why it's very important for you to learn the difference between array and linked list data structure and understand when to use an array over linked list and vice-versa. Though this discussion is valid from C/C++ and other programming language perspective, I'll give you examples and explanation in Java.

Can you make a class Static in Java?

This is one of the tricky questions in Java because there is no straight forward Yes and No answer here. You cannot make a top level class static in Java but Yes, you can make a nested class static in Java. In fact, it is even advised (see Effective Java) to prefer a nested static class in Java than normal inner classes. Now, the question comes what is a top level class and what is a nested class in Java? Well, you can declare multiple classes in a single Java source file. A class is said to be top level if it is not inside any other class and a class which is inside another class is known as nested class. You can create nested class inside another top level or another nested class in Java. This is the class which can be static in Java.

Counting Sort in Java - Example

The Counting sort algorithm, like Radix sort and bucket sort, is an integer based algorithm (i.e. the values of the input array are assumed to be integers). Hence counting sort is among the fastest sorting algorithms around, in theory. It is also one of the few linear sorting algorithm or O(n) sorting algorithm. It's quite common in Java interviews nowadays to ask, whether do you know any O(n) sorting algorithm or not. If you face this question in future, you can mention Radix sort, bucket sort, or counting sort algorithms.  How does counting sort algorithm works? Well, counting sort creates a bucket for each value and keep a counter in each bucket. Then each time a value is encountered in the input collection,  the appropriate counter is incremented.

99 Angular JS Interview Questions for Web Developers

The AngularJS is one of the popular JavaScript frameworks, I think most popular after jQuery, with the core goal of simplification. It allows building dynamic, single page web apps (SPAs) using JavaScript and supports the Model View Controller (MVC) programming structure. It has used widely and even big companies like Google, Virgin America, and HBO are using Angular JS to build their site. The demand for web developers is on all time high and there is a huge demand for developers who understand modern JavaScript frameworks e.g. Angular JS, jQuery, Facebook's React JS etc. The Angular JS is Open-source, front-end JavaScript framework which is developed by Google, it mainly competes with Facebook's ReactJS framework.

What is the use of DispatcherServlet in Spring MVC? Interview Question

How DispatcherServlet works internally in Spring MVC or What is the role of DispatcherServlet in Spring is some of the frequently asked Spring MVC Interview Question. You might have seen them already during your Java web development interview. In this article, I'll answer these question by explaining What is DispatcherServlet and its importance in Spring MVC. The DispatcherServlet is one of the important components of Spring MVC web framework and acts as a Front Controller. Similar to other Java web framework, Spring MVC also uses a front controller to receive all incoming request and delegates to other components for further processing e.g. Spring MVC controllers which are annotated using @Controller annotation and ViewResolvers e.g InternalResourceViewResolver class.

Difference between Correlated and Non-Correlated Subquery in SQL

The correlated subquery is one of the tricky concepts of SQL. It's similar to recursion in programming which many programmers struggle to understand, but like recursion, it also offers the unique capability to solve many SQL query based problems e.g. second highest salary problem where you need to compare one row of the table to another row. It gives you a different kind of power. The main difference between a regular, non-correlated and correlated subquery in SQL is in their working, a regular subquery just run once and return a value or a set of values which is used by outer query, but correlated subquery runs for each row returned by the outer query because the output of the whole query is based upon comparing the data returned by one row to the all other rows of the table. That's why it is also very slow and generally avoided until you don't know any other way to solve the problem.

10 Books to Prepare Technical Programming/Coding Job Interviews

If you are preparing for a technical interview on software development sector and looking for some great books to boost your preparation, you have come to the right place. In this article, I am going to share some of the best programming/coding interview books to prepare well for any software development jobs. These books are enough to crack even the toughest of the job interviews at Google, Microsoft, or Amazon. They provide excellent coverage of all essential topics for programming job interviews e.g. data structure and algorithms, system design, algorithm design, computer science fundamentals, SQL, Linux, Java, Networking etc.

10 points about lambda expressions in Java 8

The Lambda expression is one of the important features of Java 8 but if you look from a developer's point of view, it is nothing but a way to pass code to a method in Java. Technically, it's an expression where you can define parameters and then the code which uses those parameters, similar to a method in Java, but you don't need to write boilerplate code e.g. method name, return type, argument type etc. Most of those details are inferred by compiler and JVM from the context in which lambda expression is used. Some of you question, why lambda expression was introduced in the first place? Is it just the replacement of Anonymous class? Well, the lambda expression is more than that because it also introduces functional programming in Java.

Now, Java has best of both world i.e. Object oriented programming and Functional programming which means you can write even more scalable and robust, mission critical application in Java.

10 points about final modifier in Java

Here are some important details about final modifier in Java:

1) The final is a modifier in Java, which can be applied to a variable, a method or a class.

2) When a final modifier is used with a class then the class cannot be extended further. This is one way to protect your class from being subclassed and often sensitive classes are made final due to security reason. This is also one of the reasons why String and wrapper classes are final in Java.

3) When the final keyword is used with a method that it cannot be overridden in Java, which means you cannot override the logic of the method in the subclass. This is also done to protect the original logic of method.

Top 10 REST API and RESTful Web Services Book for Java Web Developers - Part 1

In recent years, REST has become the standard style for developing web services, also known as RESTful Web Services. These web services take advantage of REST principles, which leverages all goodness of HTTP to provide scalable and robust web services. As a Java web developer, it's high time that you get familiar with the REST concepts and the REST style of developing web services in Java, also known as RESTful web services and nothing is better than to start with a good book. I often receive request about which book should I read to learn REST? or what are some best books to learn to develop RESTful Web services in Java etc? In this article, I will suggest some books which will teach you both designing a REST API and developing RESTful web services in Java.

Is it Possible to take Spring Certification without training course?

It wasn't possible until last month to take Spring certification without mandatory training course but from 10th May 2017 onwards, you can take Spring Certification without training course. Yes, you read it correctly, it's possible to become Spring certified developer without spending USD 3200 on mandatory Spring training e.g. Core Spring training or Spring Web Application Developer training. For years, Pivotal, company behind Spring framework ensured that a Java developer can only get Spring certification by first going to into a 4-day training run by Pivotal and its partner around the world. Even though training can be taken at classroom or online, the high cost of training was the main hindrance for Java developers who were interested in doing Spring certifications.

Difference between var, val, and def in Scala

This is one of the frequently asked questions from Scala interviews. Even though both var and val keyword is used to declare variables in Scala there is a subtle difference between them. A var is a variable. It’s a mutable reference to a value. Since it’s mutable, its value may change through the program lifetime. On the other hand, val keyword represents a value. It’s an immutable reference, meaning that its value never changes. Once assigned it will always keep the same value. It’s similar to a final variable in Java or constants in other languages. It's also worth to remember that the variable type cannot change in Scala. You may say that a var behaves similarly to Java variables.

10 Free Java 8 Certification Sample Questions - OCAJP8 and OCPJP8 - 1Z0-808 and 1Z09 dumps

If you are preparing for Oracle Java SE 8 Certifications e.g. OCAJP8 and OCJP8, also known as exam 1Z0-808 and 1Z0-809 and looking for some free practice tests then you have come to the right place. In this article, I am going to share some of the best OCAJP 8 and OCPJP 8 mock tests available for free of cost online, so that you can check your speed and accuracy before the real exam. These tests are not just useful for Oracle's Java OCA and OCP certification but also for upgrade exams like OCJP 8 upgrade exams with code 1Z0-810 and 1Z0-813, upgrade to Java SE 8 from Java 6 and prior version. Many of these practice tests are like web simulator where you need to solve a relatively small number of questions within 45 to 60 minutes. The web simulator also includes timer so that you can finish these free mock tests on time.

Binary Tree Post Order Traversal in Java Without Recursion - Example Tutorial

In the last article, I have shown you how to implement post order traversal in a binary tree using recursion and today I am going to teach you about post order traversal without recursion. To be honest, the iterative algorithm of post-order traversal is the toughest among the iterative pre-order and in-order traversal algorithm. The process of post order traversal remains same but the algorithm to achieve that effect is different. Since post-order traversal is a depth-first algorithm, you go deep before you go wide. The left subtree is visited first, followed by right subtree and finally the value of a node is printed. This is the reason why the value of root is printed last in the post-order traversal algorithm.

How to Prepare for Java Certifications like OCAJP, OCPJP, or OCEJWCD?

No doubt that Oracle's Java certification is one of the most valuable certification for IT industry and helps you to get a better job, a better pay, and a better rise in your current salary. It also improves your recognition and job prospects because many big clients demands certified Java programmers for their mission critical applications. Because of huge popularity and usefulness, many Java developers and computer science graduate aspire for Java certifications. I often receive queries like, what is the best way to prepare for Java certifications like OCAJP or OCPJP? or I am already coding in Java, do I need to prepare explicitly for this exam to do well or my Java development experience is enough? I have 5 years of experience in Java, do I need to prepare for OCAJP 8 or OCPJP 8 exam? etc.

Top 5 Books Java 8 Certifications - 1Z0-808 (OCA) and 1Z0-809 (OCP)

In order to become a Java 8 Certified developer, you need to pass two exams, the OCAJP 8 exam with code 1Z0-808 and the OCPJP8 exam with code 1Z0-809. You will not be a Java SE 8 certified programmer if you just pass the OCAJP8 exam. In order to prepare for both these exams, you need to choose a good study guide and a good mock exam simulator, apart from writing programs on daily basis. Since there are a lot of demand for Java 8 certified professionals across the world, it seems to be a good opportunity to change your career path by learning Java 8, if you are doing some boring IT work and wants to become an application developer. The Java certifications will provide you both knowledge and competitive edge over other candidates who are applying for same Java developer job.

Top 10 Free Python Programming Books - Download PDF or Read Online

Every Programmer loves free eBook, even more, if it comes from renowned technical book publishers like Oreilly or Manning. In the last article, I have shared some of the best free Java programming books and today I am going to share some of the equally best free Python Programming books. These books are not illegal copies which are uploaded into the internet, but they are the legal copies, made free by their author and publishers. Though these are not full-fledged books but concise eBooks, they are very informative and comprehensive enough to learn things like Data Science and Functional programming in Python.

How to convert JSON String to Java Object - Gson/JSON Deserialization Example

In the last article, you have learned how to convert a Java object to JSON String and in today's article, you will learn the opposite, i.e. converting a JSON String to Java object. The first example was known as JSON serialization example and this one is known as JSON deserialization because we are creating a Java object from a String. The idea is very similar to classical Serialization in Java where you convert a Java object to another binary format which can be transported over the network or can be saved in the disk for further usage. That's why the process of converting a Java object to JSON is known as serialization and converting a JSON document to Java object is known as De-Serialization. You can use any JSON library to perform serialization and de-serialization e.g. Jackson Databind, Gson, or Json-simple.  In this program, I'll show you how to use Gson to create a Java object from given JSON String.

How to convert Java object to JSON String - Gson Java/JSON Serialization Example

If you are a Java or Android developer and learning JSON to support JSON format for your project and looking for a quick and simple way to convert your Java object into json format then you have come to the right place. In this article, I'll teach you how to convert a Java object to JSON document using Google's Java library called Gson. This library allows you to convert both Java object to JSON String and a JSON document to Java object. So, let's first do some serialization. Serialization in the context of Gson means mapping a Java object to its JSON representation. In the real world, the data can be really complex with lots of attributes and nested with composed object but for now, we'll start with a class which just contain few value attributes e.g. String, int and boolean.

Java Program to calculate Perimeter/Circumference of Circle

One of the common programming exercise for beginners is to write a program to calculate the perimeter or circumference of a circle in Java. This exercise is not just common in Java but also on other programming language courses e.g. C, C++ or Python. I first did this exercise on C++ long ago, but that time the joy of a working program was something different. I was quite happy to see my program compiled without error and can print the correct circumference after entering radius. That program taught me how to take input from a user and how to display output into the console, I didn't know about how to create methods to encapsulate code. For us, only main method matters at that time. Anyway, let's focus on the job in hand i.e. how to find the circumference of Circle of given radius. You have to accept radius from the user and show the output to console.

4 Differences between ISNULL vs COALESCE in SQL Server

Even though both ISNULL() and COALESCE() function provides alternate values to NULL in SQL Server e.g. replacing NULL values with empty String, there are some key differences between them, and the key difference between them is that  COALESCE() is a standard function but ISNULL() is a SQL Server specific, which means it's not guaranteed to be supported by other database vendors like Oracle, MySQL or PostgreSQL. But, perhaps the most important difference between them is that COALESCE is more flexible and powerful than ISNULL(). With ISNULL(), you can only provide one alternate value but with COALESCE you can provide more than one e.g. if col1 IS NULL then take value from column2, if that is NULL then take the default value. Btw, that's not the only differences, there are three key differences between ISNULL() and COALESCE() which we will explore in this article.

How to convert Java 8 Stream to Array or ArrayList - Example Tutorial

It's relatively easy to convert a Stream to an array in Java 8 by using the toArray() method of java.util.Stream class. By using this method you can convert any type of Stream to a corresponding array e.g. a Stream of Strings can be converted into an array of String, or a Stream of integers can be converted into an array of Integers. The Stream.toArray() method is also overloaded, the one which doesn't take any parameter returns an Object[] which might not be very useful, particularly if you want to convert Stream of T to array of T. On the other hand, the overloaded version of toArray(IntFunction[] generator) returns an array containing the elements of this stream, using the provided generator function to allocate the returned array, as well as any additional arrays that might be required for a partitioned execution or for resizing.

SOAP and RESTful - Best Books to Learn Web Service in Java

If you are a Java developer and want to learn how to develop Web Services in Java, both SOAP and RESTful, but confused on where to start, then you have come to the right place. In this article, I am going to share some of the best books to learn about both SOAP and RESTful web services in Java. If you are not familiar with Web Services, it's way to expose the services provided by your application to other developers and application. For example, if your system provides weather information then the user can go and check whether manually by looking at the Web GUI built using HTML, CSS, and JavaScript, but by exposing the same information using Web services, you allow a programmer to display as they want.   A programmer can invoke your web service from a smartphone application and show weather-related information in a weather app. The web service really makes your services more accessible and opens a new way to show the information to different users.

How to add JAR file in Eclipse Project Build path - External dependency

In this Java Eclipse tutorial, I will show you two ways to add external JAR files in Eclipse Java projects. Many times we need to use external JAR files in our Java application for different needs e.g. for general purpose you may use Google Guava or Apache Commons. If you are using Spring or Hibernate framework then you need their JAR files as well. In order to use any third-party library or framework, we have to add their JAR files in the classpath, to compile and run our Java programs. Since Eclipse is the most popular IDE for developing Java applications, it's important to know how you can add external JARs into your Java project's build path. For example, suppose, you have downloaded Apache commons JAR file from the internet and wants to add that file to your Java project. In order to use classes and methods from that library, your project must reference those and this is what we will learn here.

Top 10 OCAJP and OCPJP Exam Simulators for Java Certifications

There is no doubt that exam simulators play an important role in preparing for any Java certification e.g. OCAJP, OCPJP, OCEJWCD,   OCMJEA exams. In fact, they are one of the most important pillars because choosing a good exam simulator with a good book is generally the success mantra of many Java certification aspirants. The exam simulators prepare you well for exams by presenting the level of questions you can expect in real exams. They provide the much needed practice in exam like environment to gauge your speed and accuracy. I have personally seen the difference of 30% in score between people who do a lot of mock exams and who just goes without practicing mock exams. Candidates make more mistakes when they first took exams and by participating in mock tests, you train your mind to do fewer mistakes. They also help you to better handle the time pressure of real exam.

2 Best Books to Learn Hibernate for Java Developers

Hibernate is the leading ORM (Object to relational) framework in Java world used to implement persistence layer of enterprise Java applications. It was one of the first Java frameworks on ORM persistence and exists even before the Java Persistence API was introduced. It has since then implement JPA interfaces and you can use Hibernate as one of the JPA implementation. In fact, it is one of the most popular JPA implementation in Java world. I receive a lot of email about books and tutorial to learn Hibernate, especially from intermediate Java developers, who has a couple of years of experience in Java but new to Hibernate. It is also a very useful skill to have on your resume because they are a lot of companies who are using Spring and Hibernate to developer enterprise Java application. So if you are looking for a job in Java world, particularly as Java web development role learning both Spring and Hibernate can help you to get your dream job.

12 Advanced Java programming books for Experienced developers - Part 2

This is the second part of 12 must read advance Java programming books for intermediate and experienced Java programmers. In the first part, I have shared books to learn and master concurrency, performance, design patterns, and Java collection framework. In this part, I will talk about more advanced concepts e.g. security, Java 8, best practices etc. As an experienced Java developer, a lot is expected from you. Junior developers look at you for guidance and project managers look at you to solve problems and bail them out at key junctures. If you don't have solid knowledge of the various aspect of software development, testing, deployment, and documentation, you won't be able to do your job properly and rise in your career.