HTML

Top 15 Spring Boot Interview Questions with Answers for Java/JEE Programmers

Hello guys, if you are preparing for your next Java interview and Job description mentioned about Spring framework, then you should also prepare some Spring Boot interview questions to avoid disappointment. The Spring Boot is now the standard way to use Spring framework for Java development and almost all the companies are moving from the traditional way of using Spring Framework to more modern Spring Boot way. Gone are the days, where questions like have you used Spring Boot was asked to the developer. Nowadays interview expects more knowledge of Spring Boot from candidates and there are reasons for it, which we'll explore in this article.

Top 5 Books to Learn Grails Framework for Java and Groovy Developers.

Earlier, I have shared some of the must-read Groovy books and today, I'll share some of the best books to learn Grails for Java developers. Grails is a web application development framework completely written in Groovy. The Grails and Gradle framework are built using Groovy language. Grails is the framework to develop a web application using Groovy. The concepts within Grails, like interceptors, tag libs, and Groovy Server Pages (GSP) are very similar to what we have in Java. You'll be amazed at how quickly you can have a first-class web application up and running from ground zero. Grails includes everything you need in a single zip file on a web server (Jetty), a database (HSQLDB), Spring, Hibernate, even a Groovy version of Ant called GANT.

Java 8 - Stream.collect() Example

The collect() method of Stream class can be used to accumulate elements of any Stream into a Collection. In Java 8, you will often write code which converts a Collection e.g. List or Set to Stream and then applies some logic using functional programming methods like the filter, map, flatMap and then converts the result back to the Collection e.g. List, Set or Map. In this last part, the collect() method of Stream helps. It accepts a Collector to accumulate elements of Stream into specified Collection. The Collector class provides different methods e.g. toList(), toSet(), toMap(), and toConcurrentMap() to collect the result of Stream into List, Set, Map, and ConcurrentMap in Java.

21 Websites to Learn How to Code for Free Online

Hello there, if you are someone who is learning programming and coding by yourself and looking for some awesome resources then you have come to the right place. In this article, I am going to share 25 websites you can use to learn the code for free from the comfort of your office and home.

1. plurasight.com
One of the best website to learn any technology or IT courses e.g. programming language like Java, web development framework e.g. Spring Framework, Hibernate etc. It's also now acquired CodeSchool which earlier allows you to learn web technologies by doing it. I use this website to learn a lot of cool stuff in no time.

What is double colon (::) operator in Java 8 - Example

The double colon (::) operator is known as the method reference in Java 8. Method references are expressions which have the same treatment as a lambda expression, but instead of providing a lambda body, they refer to an existing method by name. For example, to print all elements of the list you can use the forEach() method as follows

list.stream.forEach( s-> System.out.println(s));

but here you can replace lambda expression with method reference to improve readability as shown below:

list.stream.forEach( System.out::println);

You can use method reference or double colon operator to refer a static method, an instance method, or a constructor.

5 Best Courses to Learn Spring Boot in 2018

Hello guys, if you remember, one of my goals was to learn Spring Boot in 2018 and I have started working towards it. As I have talked about my 3 point action plan to learn a new technology, the first step is to attend some online courses and start building from that. If you are not sure what is Spring Boot and why should you learn Spring Boot then let me tell you that it should be the first Java framework you should learn in 2018. The Spring Boot makes it really easy to work with Spring framework by removing all the starting hurdles with respect to setup and configuration. In one word, it makes it possible to write Spring-based Java application and run them like core Java application e.g. from the main method.

Top 35 Java String Interview Questions with Answers

The  String class and concept is a very important class in Java. There is not a single Java program out there which is not using String objects and that's why it's very important from interview point of view as well. In this article, I am going to share 35 String based questions from different Java interviews. It includes questions on java.lang.String class as well as string as data structure e.g. some coding questions something like I have shared in my earlier article about 75 Coding questions to Crack any Programming Job interviews.  You can use this list to refresh your knowledge about String in Java as well as to prepare for your next Java interview. If you have any good String questions which are not on this list, feel free to drop a note and I'll include in this list.

3 Ways to Convert String to Short in Java

In last a couple of examples, I have taught you how to convert String to Integer, Long, Double, Float, Boolean, and Byte in Java and today I will show you how to convert String to Short in Java, but before that let's revise what is short data type in Java. The short is an integral data type similar to the int but it only takes 2 bytes to store data as compared to 4 bytes required by an int variable. Since it takes only 2 bytes or 16 bits to store data, the range of short is also shorter than int. It ranges from -32,768 to 32767 (inclusive) or -2^15 to 2^15 -1. You might be wondering why upper bound is 255 and lower bound is -256 but that's because we have included zero in between.

2 Ways to Add Binary Numbers in Java - Coding

In the last article, I have shown you how to subtract binary numbers in Java and today, you will learn the opposite i.e. how to add binary numbers in Java. You can do binary addition in Java either by writing your own logic or by taking advantage of the Java API, which allows you to convert a binary String into a binary number. Though, if you want you can also use the logic I have shared in my earlier post about how to check binary numbers to verify input before converting it to a binary number. In this article, we'll take a look at both methods of adding two binary numbers in Java.

How to Rotate an Array to Left and Right by Given Number in Java?

Hello guys, welcome to this post with another array based coding problem. In the last article, we've learned about finding missing numbers in the array with duplicates and today we'll solve the problem of rotating an array by left or right by given number. For example, suppose an integer array {1, 2, 3} is given and it was asked to rate this array to the left by 3 then the result array will look like {2, 3, 1} because it was rotated twice on left. Similarly if asked to rotate the same array twice by right then we'll get {1, 2, 3}, the same array is back. This is an interesting problem and it's quite easy to solve but I have many programmers struggles with this one as well. So, a little bit of practice and learning will not hurt.

Difference between @SpringBootApplication vs @EnableAutoConfiguration annotations in Spring Boot

Even though both @SpringBootApplication and @EnableAutoConfiguration can be used to enable the auto-configuration feature of Spring Boot there is a subtle difference between them. The @SpringBootApplication does much more than what @EnableAutoConfiguration do. It's actually a combination of three annotations: @Configuration which is used in Java-based configuration on Spring framework, @ComponentScan to enable component scanning of components you write e.g. @Controller classes, and @EnableAutoConfgiuration itself, which is used to enable auto-configuration in Spring Boot application. Spring Boot designers realize that these three annotations are frequently used together so they bundled them into @SpringBootApplicaiton. Now, instead of three annotations you just need to specify one annotation on your Main class.

How to Implement a Power Function in Java - Coding Problems

Even though the Java library has a power function, Math.pow() to calculate the power of a given number in Java, it's a common programming exercise for Java programmer to implement a power function. If you have used the Math class then you know that the java.lang.Math.pow(double a, double b) returns the value of the first number raised to the power of the second number and you need to do the same. In other words, you need to write a Java function to calculate the power of integer numbers for simplicity. The original method accepts a double value but you are allowed to use just integer but beware that power function may overflow.

Top 20 System Design Interview Questions for Java Programmers

System design questions are an important part of programming job interviews and if you want to do well, you must prepare this topic. In the past, when I shared my list of programming interview questions, I have shared a couple of System design questions but my readers kept asking me for more questions, as it is a hard topic to master and more and more practice is needed. I had my own list of questions which I have collected from various interviews with friends and colleagues but I needed more questions for this article and my own preparation then I stumbled upon Grokking System Design Interview course. It's an excellent resource because it not only gives you a lot of System design question but also provide all the knowledge and tools you need to solve those questions.

Java - String charAt Example - How to get first and last characters

The charAt(int index) method of java.lang.String class can be used to retrieve a character from given index. The method returns a character, you can see its return type is char. The index starts from zero and ranges to length() - 1 where length() return the length of String. It's similar to an array where the first element is stored at zeroth index and the last element is stored at length -1 index because String is nothing but backed by a character array. If the value of the index is invalid i.e. it's lower than zero or negative or higher than length - 1 then this method throws an IndexOutOfBoundsException. In this article, I'll show you a couple of example of how to use the charAt() method to retrieve a character from String in Java.

Top 75 Programming Interview Questions Answers to Crack Any Coding Job Interview

Hello guys, if you are preparing for your next Programming Job interview and looking for some frequently asked Coding or Programming questions to practice then you have come to the right place. In this article, I am going to share some of the most commonly asked Coding questions from Programming Job interviews. In order to do well on the Coding interview you need practice, you just can't go there and expect to solve the coding problems in limited time. Sometimes, the interviewer also asks little bit easier coding questions on telephonic interview e.g. revering array in place or reversing a string in place.

Top 5 Amazon Web Services or AWS Courses to Learn Online - FREE and Best of Lot

Hello guys, if you want to learn Amazon Web Services, popularly known as AWS and looking for some awesome resources e.g. books, courses, and tutorials then you have come to the right place. In this article, I am going to share some of the best Amazon Web Services or AWS courses which will help you to learn this revolutionary and valuable technology free of cost. Unlike other paid courses, these are genuine free AWS courses which are made free by their authors and instructors for the promotional and educational purpose. You just need to enroll with them and then you can learn AWS at any time, at any place and on your own schedule. But, if you are completely new to AWS domain or Cloud let me give you a brief overview of Amazon Web Services and its benefits over traditional infrastructure setup.

How to java.lang.NoClassDefFoundError: org/springframework/beans/factory/SmartInitializingSingleton in Spring Boot

Problem:
I was trying to run a HelloWorld program using Spring Boot when I got this error:

Exception in thread "main" java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer due to internal class not found. This can happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:52)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:92)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:174)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:136)

Top 5 Free TypeScript Courses to Learn Online - Best of Lot

If you are interested in learning TypeScript or Angular, one of the popular JavaScript framework for developing front-end, which uses TypeScript and looking for some resources e.g. books, tutorials and courses then you have come to the right place. In this article, I am going to share some of the best, free TypeScript online courses you can use to learn this powerful programming language. For those who don't know TypeScript, it's a new dynamically typed programming language from Microsoft which augments JavaScript's programming syntax by adding some new features which help in object-oriented application development, particularly introduction of Types.

Top 5 Free Big Data Courses to learn Hadoop, Spark Online - Best of Lot

If you want to learn Big Data technologies in 2018 e.g. Hadoop, Apache Spark, and Apache Kafka and you are looking for some free resources e.g. books, courses, and tutorials then you have come to the right place. In this article, I am going to share some of the best free online courses to learn Hadoop and Spark from Udemy and Pluarlsight at your own pace. I personally like to start with FREE resources before I have enough knowledge to choose the right book or enroll in a little expensive course. It's also my passion to surf web to find great free resources and share with you guys.

10 Tools Java Developers Should Learn in 2018

We are in the second quarter of 2018 and many programmers have already started making a good process to their goals for 2018, which is very good, but if you are someone, who is still not sure what to learn in 2018 then you have come to the right place. In past, I have shared 10 things Java developers to learn in 2018 and last week I published top 5 Java Frameworks to learn, but there is one topic which kept coming from my readers.  The question which I have received this week a couple of times form my fellow Java developers and readers is which tools Java programmers should learn in 2018? or what are some good Java tools used in application development? and finally, what should I learn in 2018? I have been answering this question by writing blog posts e.g. 10 Testing Tools Java developers should learn in 2018 and in this article, I am going to share some of the best Java tools you can learn in 2018.

Java CountDownLatch Example - Multithreading and Concurrency Tutorial

The CountDownLatch is an important concurrency utility class which was added in JDK 1.5 but unfortunately, many Java developers still struggle to understand and use this powerful tool. You can use CountDownLatch if you are spawning multiple threads to do different jobs and want to know when exactly all tasks are finished so that you can move to next stage. In other words, you can block a thread until other threads complete their task. One of the good examples where you can use CountDownLatch is an application which downloads data from a database or another application. For example, we are creating a Java program to download all Udemy courses. Since Udemy has thousands of courses, you create different threads to download different categories e.g. technology, development etc.

5 Free Apache Spark Course for Java, Scala, and Python Programmers to learn Online

Hello guys, if you are thinking to learn Apache Spark to start your Big Data journey and looking for some awesome free resources e.g. books, tutorials, and courses then you have come to the right place. In this article, I am going to share some of the best, free online Apache Spark courses for Java, Scala and Python developers. If you don't know what is Apache Spark? and Why it's so important in Big Data world then let me give you a brief overview first. Apache Spark is another cluster computing framework like Hadoop which is used to analyze a huge data set, but it's much faster as compared to Hadoop which makes it ideal for today's high computing needs e.g. processing huge amount of data.

Top 5 Free jQuery Courses for Web Developers - Best of Lot

Hello guys, if you are thinking to learn jQuery and looking for some awesome free resources e.g. books, tutorials, and online courses then you have come to the right place. In this article, I am going to share some of the best free jQuery courses from Udemy and Pluarlsight which you can take to learn this awesome JavaScript library. In the past, I have also shared some free books and tutorials on jQuery, which complements these courses. You can also take a look at then while learning different parts of jQuery.
Before I share these free courses, let me brief you about what jQuery is and why you should learn it? Well, jQuery is a JavaScript library but unlike any other library it is very powerful and makes the client side scripting really easy.

Top 5 Free JavaScript Courses to learn Online - Best of Lot

Hello guys, If you want to learn JavaScript by yourself and looking for some free resources like books, sites, and tutorials then you have come to the right place. In this article, I am going to share some of the best free JavaScript online courses you can join to learn JavaScript by yourself, on your own schedule and at your own place. A lot of people are learning JavaScript and the number is only increasing by each passing day, and why not? It's the #1 web development language. It got tons of useful frameworks and libraries like Angular, React , Node.js, and jQuery which makes web development really easy.

21 String Programming and Coding Interview Questions With Solutions

In this article, I am going to share 21 of the most common String based Programming and Coding interview questions from Java developer interviews. These questions require you to write code to solve the problem and they are different from traditional Java String questions like how substring method works in Java or when to use the intern() method of String in Java? Since coding and problem solving is an important part of any programming job interview, it's imperative that you know how to solve them in time and on pressure situation, which comes only after doing practice with a right set of questions. Since these questions are already tried and tested and appeared in many interviews, they will provide you the experience you need to crack your coding interview.

Mergesort in Java - Algorithm Example and Tutorial

The Merge sort algorithm is a divide and conquers algorithm. In the divide and conquer paradigm, a problem is broken into small problems where each small problem still retains all the properties of the larger problem -- except its size. To solve the original problem, each piece is solved individually; then the pieces are merged back together. For example, imagine you have to sort an array of 200 elements using the selection sort algorithm. Since selection sort takes O(n^2) time, it would take about 40,000-time units to sort the array. Now imagine splitting the array into ten equal pieces and sorting each piece individually still using selection sort. Now it would take 400-time units to sort each piece; for a grand total of 10*400 = 4000.

A Simple Example to Check if File is Empty in Java

One of the readers of my blog Javarevisited emailed me yesterday about how to check if a file is empty in Java and that's why I am writing this post to show that using an example. The common approach for checking if a file is empty or not is to first check if the file exists or not and then check if it contains any content, but Java has done that hard work for you. Well, it's pretty easy to check emptiness for a file in Java by using length() method of the java.io.File class. This method returns zero if the file is empty, but the good thing is it also returns zero if the file doesn't exist. Which means you don't need to check if the file exists or not.

How to use CallabeStatement in JDBC to call Stored Procedure in Java? Example

CallableStatement of JDBC API is used to call the stored procedure from Java Program. Calling a stored procedure follows the same pattern as creating PreparedStatment and than executing it. You first need to create a database connection by supplying all the relevant details e.g. database URL, which comprise JDBC protocol and hostname, username, and password. Make sure your JDBC URL is acceptable by JDBC driver you are using to connect to the database. Every database vendor uses different JDBC URL and they have different driver JAR which must be in your classpath before you can run the stored procedure from Java Program.

Top 5 Free C++ Courses to Learn Programming Online - Best of Lot

C++ is one of the most popular and powerful object-oriented programming languages and if you want to do low-level stuff then it's the best language to start with. Most of the complex software e.g. Operating Systems, Database Management Systems, and Powerful trading systems are written in C++. While many of us have learned to program by using C and C++, let me honest with you learning C++ is challenging. There are many areas which are tough to grasp e.g. points but you will learn them slowly and that's where these free C++ course will help you.

Top 5 Free Courses to Learn Web Development in 2018 - Best of Lot

Hello guys, I have been sharing a lot of free online courses and books on various technology and programming language e.g, Python, Java, C++, JavaScript, PHPReact, Angular, Spring in this blog from quite some time and today I have brought some great free courses to learn basics of web development. Web Development is an important skill for programmers in this era of Startups. As a programmer or software developer, you should know how to create a website and how to create a mobile app of your own. Though it's not easy. Coding is like art and many people born with coding sense, I mean they love coding, they love to create stuff e.g. websites, mobile apps, games etc and they love to automate things. They are a very good self-learner and almost learn anything by themselves, but don't get discouraged if you don't have those skills. By perseverance and hard work, you can also learn whatever you want. In the past, I have shared some tips to learn a new technology and books and courses are an integral part of it.

Java Program to Subtract two Binary Numbers

Binary subtraction is very similar to binary addition which we have learned in the last article. In this tutorial, you will learn how to subtract two binary numbers. Similar to the last article, we'll see two ways, first by converting binary String to a binary number and then doing subtraction. You can use the Java API Integer.toString(number, radix) for that. On second solution you will learn to develop the logic to perform binary subtraction in Java program by using rules you might have learned in your computer classes. Here is a little summary of how binary subtraction works.

Difference between a List and ArrayList Reference Variable in Java?

Someone who is just starting with Java programming language often has doubt about how we are storing an ArrayList object in List variable, what is the difference between List and ArrayList? or why not just store the ArrayList object in ArrayList variable just like we do for String, int, and other data types. Well, the main difference between List and ArrayList is that List is an interface while ArrayList is a class. Most importantly, it implements the List interface, which also means that ArrayList is a subtype of List interface. In Java or any object oriented language, super type of variable can store an object of subtype. This is known as Polymorphism because any virtual method will be executed from subclass only, even though they were called from super type. This is the beginning, now let's see those two questions as well.

Difference between OCAJP7 and OCAJP8 Certification - 1Z0-803 vs 1Z0-809

One of the frequently asked questions asked by most of the OCAJP certification candidates is, what are the differences between OCAJP 8 and OCAJP 7? And,  Which one Java developers should go for in 2018? OCAJP7 or OCAJP8? The obvious answer to this question is the latest Java version of the exam i.e. OCAJP 8. Since it's already more than 5 months since Java 9 is out but there is no OCAJP 9 certification, the OCAJP 8 should be the exam, Java developer should pursue in 2018. The question is more for those who are looking to become certified Java developer in quick time and doesn't know Java 8 yet e.g. experienced Java developers who have extensively worked in Java SE 6 and prior version but don't have any Java certification yet.

How to Compare Two Dates in Java? Check If They Are Equal, Later or Earlier

There are multiple ways to compare two dates in Java, it also depends on upon what exactly comparison means. If you are looking to compare two dates to find out whether they are equal or not, then you can simply use equals() method of java.util.Date class. This method will return true if both dates are equal, precisely both thave same millisecond value. If you are looking to find out whether a date comes before or after another date then you have 3 choices, you can use compareTo() method of java.util.Date class, or you can use before() and after() method of Date class, or you can use before() and after() method of Calendar class. I suggest leveraging before() and after() method of Date class, they are more readable and easy to use.

Java - InstanceOf KeyWord Example and Tutorial

The Java programming language and JVM are full of hidden gems and even though I am using Java for more than a decade I still get surprised of features which I didn't know for quite some time e.g. shutdown hook, covariant method overriding, and JVM option to refresh DNS cache.  The instanceof operator is also one of the rarely known features of Java, It is used to check if an object is the instance of a particular Class or not. It returns true if the object is an instance of the class, otherwise, returns false. You might have seen usages of instanceof operator in Java while overriding equals() method. Since for checking equality of two instances, the first step is to verify whether they are the instance of the same object or not, you can use the instanceof operator there.

Java - Convert String to Boolean Example

There are two ways to convert a String to boolean in Java, first, by using Boolean.parseBoolean() method and second, by using Boolean.valueOf() method.The parseBoolean() method returns an equivalent boolean value of given String, for example, if you pass "true" it will return the primitive boolean value true. Similarly, if you pass "false" it will return false. The good thing about this method is that it is case insensitive, which means if you pass "true", "TRUE", or "True" you will still get a true boolean value.

Java String 101 - What Every Java Developer Should Know about java.lang.String Class

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.

5 Java 9 Courses to Learn Online - Best of Lot

It's been a couple of months since JDK 9 went GA. The new release of Java is packed with some powerful features e.g. modules, API enhancements e.g. factory methods for an immutable list, set, and map, some changes on stream API and optional class, new features on process API etc. Since it's always good to keep yourself up-to-date, its time to spend some time to learn those new features and make use of them to write better code in Java.

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.

10 ways to learn a New Technology, Programming language, Frameworks, or Libraries

One of the main challenges of being a programmer or software engineer is the constant learning. Yes, that's true. As a programmer or developer, we always need to learn new things, sometimes every year. Thanks to C, Java, Linux, and SQL, we still have some ground but the way these technologies are used changes every year. For example, we have a new JDK 9 release in 2017, even though many Java developers are still learning Java 8. We also have a Spring Framework 5.0 release in 2017, combined with Spring Security 5.0 and Spring Boot 2.0 release, which many of us need to learn in 2018.

Top 20 Essential Java Interview Questions with Answers for Freshers with 1 to 2 years Experienced

If you are grad looking for an internship position in a company which uses Java, or a fresher, just out from college and looking out for Java development position, then this post is for you. I have attended, taken and participated in a different level of Java interviews, and I can say there is a huge difference between them, which is not surprising because you obviously want to ask different level questions based upon whether the candidate is fresher or experienced. Similarly, the question at phone interview, written test, and face to face interviews, keeping this in mind, and give you always have a limited amount of time before going for any interview, It's important to prepare right set of questions.

Top 5 Free JDBC Courses for Java Programmers - Best of Lot

If you are a Java programmer and looking for some free JDBC courses to start learning database access in Java then you have come to the right place. In this article, I am going to share some of the free online JDBC (Java Database Connectivity) courses from popular sites like Udemy and Pluarlsight to give you a head-start in your long journey of writing real-world Java application which interacts with the database. Since Data is the utmost important part of any Java application, it's imperative to have a good knowledge of how to interact with the database from Java application and JDBC is the first step in that direction.

Top 5 Free Angular Courses for Web Developers to Learn Online

Angular is one of the most popular JavaScript frameworks for creating web apps. It helps you in creating complex web applications in less time. It's maintained by Google so you can also rest assured that this powerhouse of a framework is built with speed and purpose and here for a long run.  Angular is also the most popular framework in the world for building single page applications.  The framework was first launched as Angular JS which allowed building a web application using Model View Controller concept and it was hugely popular but it was later re-written completely, which is now known as simply Angular or Angular 2. Even though many web developers use Angular and Angular JS interchangeably they are very different and don't share anything expect Angular in their Name.

5 Free PHP and MySQL Courses for Web Developers

If you want to build web applications in quick time then PHP and MySQL is a good choice. PHP and MySQL are incredibly powerful open source technologies that allow programmers and web developers to create functional websites and apps that go way beyond basic HTML. PHP is specially created to generate interactive and dynamic websites and also known as server-side scripting language while MySQL is one of the leading relational databases along with Oracle and Microsoft SQL server. While it may seem intimidating to create a website using PHP and MySQL, especially for someone who has no experience in coding, it's not that difficult. With the right guidance and resources e.g. books and courses you can put together a PHP MySQL website in a week or so.

Top 10 Java 9 Tutorials and Courses - Best of Lot Must Read

It's been more than a couple of months since JDK 9 was launched and the new year is probably the best time to learn Java 9 and get yourself familiar with new features and enhancements on existing APIs. The highlight of JDK 9 release was Project Jigsaw or Module system. The Java 9 Platform Module System allows Java to move forward by modularizing the JDK as well as adding modules as first-class citizens to Java, but that's not the only thing to look forward, there are many small changes which are very useful in day-to-day coding. For me the static factory methods introduced in List, Set, and Map to create a immutable list, set and the map is the most interesting one. Along with several changes on Stream API and Optional class. Those are the ones, I will most likely to use as soon as we start with JDK 9.

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.

5 Free Docker Courses for Java and DevOps Engineers

If you are an application developer working in Java or C# or any other language and wants to become a DevOps engineer or someone who wants to learn Docker then you have come to the right place. In this article, I am going to share some of the free Docker courses you can use take online to learn Docker by yourself. These courses are great for both beginners and intermediate developers who have basic ideas about Docker. If you don't know what is a Docker and how it works then let me give you a brief introduction. Before starting just look at the Docker's logo which is a whale carrying containers, does that strike something? Well, if you add this image with the name Docker you might think about shipping companies, which carry containers from one part of the world to another.

10 Books for Coders of All levels - Must Read Best of Lot

Coding is one of the most important skills for programmers and if you want to survive as a programmer you must improve your coding skill. Gone are the days, when you can get a software development job without having you to write a single line of code and then somehow survives in the job by doing support, coordination, and other non-coding activities. Companies, both big and small are increasingly testing coding skills of candidates before hiring. It's very common for programmers to pass a coding test before a telephonic round of interview. Some of the companies even hire websites like HackerRank and others to check the coding skill of potential candidates, many others give candidates take home coding tests. In short, companies have a lot of focus on the coding skill of potential hires.

Top 50 Basic Core Java Interview Questions with Answers

If you are preparing for your next Core Java interview and looking for some common question to practice or check your knowledge then you have come to the right place. In this article, I'll share 50 Core Java Interview Questions from various companies. I have already discussed the answers to these questions in this blog or Javarevisited, so I have just put the link. First, you should try to answer it yourself and if you cannot then go to the link and find the answer. You can also compare your answer with mine and learn a few things here and there. In most of my interview post, I have also shared some common techniques to drive interview towards your comfort zone and how to leave a long-lasting impression on the interviewer, you can use those techniques to do well on your Java interviews.

JDBC - Difference between PreparedStatement and Statement in Java

JDBC API provides three types of Statement for wrapping an SQL query and sending for execution to the database, they are aptly named as Statement, PreparedStatement, and CallableStatement. First one, Statement is used to execute normal SQL queries e.g. select count(*) from Courses. You can also use it to execute DDL, DML and DCL SQL statements. The second one, PreparedStatement is specialized to execute parameterized queries e.g. select * from Courses where courseId=?, you can execute this SQL multiple times by just changing the course parameters. They are compiled and cached at database end, hence quite fast for repeated execution. The third member of this family is CallableStatement, which is there to execute or call stored procedures stored in the database.

How to implement Radix Sort in Java - Algorithm Example

The radix sort, like counting sort and bucket sort, is an integer based algorithm (i.e. the values of the input array are assumed to be integers). Hence radix sort is among the fastest sorting algorithms around, in theory. It is also one of the few O(n) sorting algorithm along with a bucket and counting sort. The particular distinction for radix sort is that it creates a bucket for each cipher (i.e. digit); as such, similar to bucket sort, each bucket in radix sort must be a growable list that may admit different keys.

Java 8 Stream findFirst() and filter() Example

Suppose, you have a list of prime numbers and you need to find the first prime number which is greater than a given number? How do you find it? Don't tell that you will loop through the list and check each element and return the first element which is greater than the given number. Well, that's right but that's not what you should do in Java 8. That's good for Java 7 or earlier version but Java 8 offers you many better alternatives and one of them is Stream. You can use Stream along with filter() and findFirst() method to find out an element based upon a predicate.

10 Books Java Developers Should Read in 2018 - Best Of Lot

Hello guys, If you are Java developer and wondering what to read in 2018 then you have come to the right place. In this article, I am going to share 10 books on Java, Spring, and related technology a Java developer can read. I have included books for both experienced Java developer who is more inclined to learn about architecture stuff,  developing for Cloud, MicroService, Java 9, and Spring 5 features and thinking of learning Kotlin to improve their productivity, but I have not forgotten to junior and less experienced Java developers or some who are thinking to start their journey into Java world in 2018.

A Simple Example to Send HTTP Request from Java Program

If you are thinking is it possible to send an HTTP request from a Java program and if yes, how to send a simple HTTP GET request in Java, then you have come to the right place. In this article, I'll show you how you can use the HttpURLConnection class from java.net package to send a simple HTTP request in Java. But, first let me answer your first question, is it possible to send HTTP request in Java? Yes, it's possible and you can send any kind of HTTP request e.g. GET, POST, PUT, DELETE, HEAD, or PATCH. The java.net package provides a class called HttpURLConnection, which can be used to send any kind of HTTP or HTTPS request from Java program.

3 Books to learn Java from Scratch in 2018 - Best of Lot Must Read

I receive half a dozen emails every day asking about which is the best to learn Java from scratch? Which book should I read in 2018 to learn Java? or Which is the best Java for beginners? When I receive such email, before giving my recommendation I ask two questions, first do you have any programming experience? e.g. Are you coming from C, C++ or Python background? Or you are a fresher with no experience in programming, just a couple of classes on data structure and algorithm and operating system on college. If the guy some prior experience I recommend him the book like Core Java for the Impatient which teaches basics of Java programming language and API and also how to use Java in right way.

Why you should not use SELECT * in SQL Query

I have read many articles on the internet where people suggest that using SELECT * in SQL query is a bad practice and you should always avoid that. Instead, you should always use an explicit list of columns. That's a good suggestion and one of the SQL best practice I teach to junior developers, but many of them don't explain the reason behind it.  Unless you explain some reasons why one should not use SELECT * in queries, it's difficult to convince many SQL developers,  many of whom have started learning SQL by doing SELECT * from EMP in Oracle database. In this article, I will try to bridge that gap by giving some practical reasons of why using SELECT * in Query is not a good idea.

5 Best books to learn JDBC - Java Programming

The JDBC (Java Database connectivity) is one of the important API in Java programming language which allows a Java program to connect to any database e.g. Oracle, Microsoft SQL Server, MySQL, PostgreSQL or any other. It's very importnat API to learn and master for both core Java and Java EE professional given ubiquitous nature of Database in real world application. Despite its importance, many Java developer lack essential JDBC skills e.g. they are not familiar with Connection, Statement, connection pool, calling stored procedures and executing transaction in JDBC. One reason for that is very limited or coverage of JDBC essentials in front line Java books e.g. Head First Java 2nd Edition.

5 Free HTML and CSS Courses to Learn Front End Web Development Online

HTML and CSS are two pillars of web development, they are used to create web pages you see every day. HTML provides the structure to your web page and CSS provides them the style to look better. If you want to become a front-end web developer or web designer then a good knowledge of HTML and CSS is a must. Even though modern day web development is all about framework and library e.g. Angular and React, you still need to know HTML and CSS to understand what's going on and troubleshoot any issue you face while developing a web application. Btw, JavaScript is another pillar of web development but we'll not discuss on this article. I have already shared some good books to learn JavaScript before

5 Free Blockchain Technology Courses for Programmers

Hello guys, how are you doing? hope you all are having a great time and working towards your goal in 2018. I have been sharing a lot of courses and tutorials in this blog about what to learn in 2018, starting from tools to frameworks, from libraries to programming languages, but one of the most important technology, you can learn in in 2018 is the Blockchain technology. It's one of most talked about technology at the moment and considered to be the next big thing after the invention of the internet as they provide a way to attain digital trust on the Internet.

5 Free React Courses for JavaScript Web Developers to Learn Online

React JS is one of the most popular frameworks or Javascript library for building user interfaces. It's backed by Facebook and it's often viewed as an alternative to the Angular framework by Google. React is also very flexible, fast, easy to learn and fun to work with. It is designed to make the process of building modular, reusable user interface components simple and intuitive and that's why most of the modern GUI and web applications are build using React framework. It is developed at Facebook and focuses on the 'View' aspect of MVC in web applications. React was built for the purpose of developing applications that are large in nature and have to deal with time changing data.  So if you need fast refresh i.e. updating individual component without updating whole DOM then React is the right framework.

5 Free Object-Oriented Programming Online Courses for Programmers

The OOP or Object Oriented Programming is a paradigm which allows you to write a program by modeling real-world things in terms of class and object. It not only make to represent a real-world thing in programming world easier but also allow you to manage the complexity of your program. Even though there are several programming paradigms e.g. procedural and functional, most of the code we write today is object-oriented and some of the most of popular programming languages are object-oriented e.g. Java, Python, PHP, and JavaScript all supported object-oriented programming.

How to copy elements of one array to another array in Java - Arrays.copyOf and Arrays.copyOfRange Example

There are multiple ways to copy elements from one array in Java e.g. you can manually copy elements by using a loop, create a clone of the array, use Arrays.copyOf() method or System.arrayCopy() to start copying elements from one array to another in Java. Even though both allow you to copy elements from source to destination array, the Arrays.copyOf() is much easier to use as it takes the just original array and the length of the new array. But, this means you cannot copy subarray using this method because you are not specifying to and from an index, but don't worry there is another method in the java.util.Arrays class to copy elements from one index to other in Java, the Arrays.copyOfRange() method. Both methods are overloaded to copy different types of array.

10 Examples of Array in Java - Tutorial

Along with the String, the array is the most used data structure in Java. In fact, String is also backed by a character array in Java and other programming languages. It's very important for a Java programmer to have good knowledge of array and how to do common things with array e.g. initialization, searching, sorting, printing array in a meaningful way, comparing array, converting an array to String or ArrayList and doing some advanced slicing and dicing operation with an array in Java. Like my previous tutorials 10 example of HashMap in Java, I'll show you some practical example of array in Java. If you think, any important operation is not included, you can suggest their examples and I'll add them to this list.

5 Free Database and SQL Query Courses for Programmers to Learn Online

Hello guys, I have been sharing some free programming resources e.g. books and courses in this blog for quite some time. Earlier I have shared free courses on Java, Maven, Spring, and Data Structure and Algorithms and today I'll share some of the free online training courses to learn SQL and Database. Why you should learn SQL? Well, it's one of the must-have skill for programmers, application developer, and IT professionals. Like Linux, this is one skill which is going to serve you longer than any other programming language, framework, or library.

7 Free Selenium Web Driver Courses with Java and C# to Learn Automation Testing

Testing is an integral part of software development and we have long been relied on manual testing by testers and QA professional to ship quality software and find bugs, but that's not sustainable anymore. There is an increased focus on automation testing nowadays and Selenium is leading the way with its web driver. If you don't know what is a selenium, here is a quick intro. Selenium is a free automation testing tool for web applications. It can work with different web browsers like Chrome, Firefox, Internet Explorer, Opera and simulate human-like behavior. By using Selenium you can programmatically interact with all the different elements in a webpage. You can click on them, input text, extract text and so much more.

5 Free Ruby and Rails Courses to Learn Online

Hello guys, welcome to this post, here you will find some of the best free courses to learn Ruby programming language and Ruby on Rails framework online. If you don't know what is Ruby and what is Rails framework then let me tell you that its one of the simplest programming language with little to no syntax. If you are new to programming or never coded before then also developing a Ruby application will be much easier than choosing any other programming language like Python or Java. When it comes to developing web development, the Ruby on Rails also makes your job easy by making several useful assumptions based upon convention, which means you can do more by writing less code.

5 Free Servlet, JSP, and JDBC Online Courses for Advanced Java Developers

If you are a Java developer working on a Java JEE projects e.g. Java web application or you want to get into that by learning server-side technologies like Servlet, JSP, and JDBC then you have come to the right place. In this article, I will share some free online courses to learn Servlet, JSP, and JDBC at your own pace. If you want to become a rockstar Java web developer then you must have a good understanding of these basic web technologies before you learn frameworks like Spring and Hibernate. These frameworks work on top of these basic technologies and if you don't know them then you would often struggle to debug and troubleshoot problems in real world.

5 Free Oracle and Microsoft SQL Server Online Courses

If you are an application developer e.g. someone developing a server-side application using Java or .NET or any other programming language which uses a database like Oracle and Microsoft SQL Server or a junior DBA then you must learn these database technologies to effectively work in your Job. Even though your organization might have DBAs or Database Administrators to help you with the database, more often than not, it's application developers who end up writing SQL scripts to create data, upload data, query data, and writing complex stored procedures and triggers to implement application functionalities. DBAs job mostly does database installation, access control, security and other database admin stuff.

5 Free Eclipse and JUnit Online Courses for Java Developers

Eclipse and JUnit are two of the essential tools for Java Developers. Eclipse is a Java IDE, Integrated Development environment which allows you to code, run and debug Java program from a single window, while JUnit is a unit testing library which allows you to test your Java code automatically. You can write JUnit tests and then you can run them automatically using Maven or Gradle plugin at build time. You can further automate your build using Jenkins which means your Unit test will run continuously and automatically, reporting any break at the earlier possible opportunity.

5 Free Linux Courses for Programmers and IT Professionals to Learn Online

Linux is one of the most popular operating systems to run server-side applications. I have seen almost all Java applications running on Linux barring a couple of them which runs on Windows as service. If you take out standalone apps like IDEs or tools, most of the real world Java applications run on Linux e.g. payment gateways, trading systems, and other financial applications. That's why it's very important for any programmer, IT professional, or a developer to learn and understand Linux, both operating system, as well as command line.

5 Free Python Courses for Beginners to Learn Online

Hello guys, If you are a beginner looking for some Free Python resources to start your programming journey then you have come to the right place. Earlier, I have shared a couple of free Python Programming eBooks sand today I'll share a couple of good Python programming courses which are absolutely FREE!! You can take these online courses to learn Python at your own pace, at your own time, and at your place. This is a great advantage of online learning, the flexibility it provides is just awesome.  You just need a laptop or a smartphone with an internet connection and you can learn anything. Btw, before to start with the list of courses to learn Python programming I want to congratulate you for making the right decision to start your programming journey with Python.

6 Free Maven and Jenkins Online Courses for Java Developers

Maven and Jenkins are two of the most popular tools in the Java world. Maven helps to organize your project and provide support to build and deploy Java projects while Jenkins can provide continuous integration and delivery by completely automating build and deploy projects. As a Java developer, it's very important that you know Maven and Jenkins because every other company is using it and now knowing this will only put you behind other candidates if you go for a job. If you have yet to learn Maven and Jenkins then you have come to the right place, In this article, I will tell you 6 free course you can take to learn Maven and Jenkins online, but before that, let's understand what is Maven and Jenkins and what are their purpose.

3 Books and Courses to Learn RESTful Web Services using Spring and Java

Even though the Spring in Action 4th Edition is a good book to learn Spring framework, its not enough to learn intricacies of developing RESTful Web Service using Spring Frameowrk. It does have a chapter on developing RESTful Web Services and nicely explains concepts like @RestController, @ResponseBody, @ResponseStatus, HTTP message converters, content negotation but that barely touch the surface of developing a production quality RESTFul Web Service. There are many other things e.g. filtering, pagination, error handling, and security of RESTful Web services using Spring and Spring security which is not covered.

What is difference between an int and Integer in Java?

The first and foremost difference between an int and Integer or a char and Character is that former is a primitive data type while later is a class, also known as wrapper class because they wrap primitive data type inside it. When you first start learning Java, you start with primitive data types e.g. int, long, char, byte, boolean, float, and double but slowly you learn about Object and sometime later you know about Integer, Long, Character, Byte, Boolean, Float, and Double. At this point in time, you may wonder, what is the real difference between an int and Integer? isn't both same? We can pass Integer where int is expected and vice-versa then why on the earth we have both int and Integer?

Top 10 Open Source Frameworks and Libraries for Java Web Developers

Java programming language and Platform has been very lucky in terms of frameworks, standards, and libraries, I guess which is one of the important reason for its huge success. Apart from standard frameworks like Swing for desktop GUI application, JavaFX, Servlets and JSP, EJB, and JSF, there are lot more open source framework and libraries available for Java programmers. These Open source framework, not only helps and speed up development but also enforce to use best practices required to build enterprise Java application and desktop application. Frameworks like Spring, which in my opinion gives a much-needed boost to Java platform, enforces dependency Injection design principle at the core, which is key to build loosely coupled system.

4 examples to Send Email with Attachment from Linux using mailx command

One of the common task for programmers working in Linux machine is to send emails, for example, your Java applications are running on Linux e.g. RHEL 5 or RHEL 6 version and you need to send a report of all the clients connecting to your application. An easy way to accomplish this is to write a shell script, which will dump all clients in the log file and then use grep command and generate a report. If you have to grep logs from multiple hosts, you can also use the SSH command to run the same command on multiple hosts. Once you go the list of clients connecting to your application, you can send the CSV file to yourself in an email. Now, the question is how to send an email from Linux? and more importantly how to send an email with attachments? Well, there are different options based on whether you are running on RHEL 5 or RHEL 6.

Is it possible to instantiate an Abstract class in Java?

Earlier I have shared one of the frequently asked questions in Java, can we make an abstract class final in Java and my readers really liked and asked for more such questions. So, today I am going to talk about whether we can create an instance of an Abstract class in Java or not? This is another interesting core Java question you will find on telephonic interviews or Oracle certified Java programmer certification. The answer to this question is simple, No, you cannot instantiate an abstract class in Java because it is abstract, it is not complete hence it cannot be used.  When you create an instance of a class, its's constructor is called and even though abstract class can have a constructor, the compiler will not allow you to create an instance of the class. It's a compile-time error to create an instance of an abstract class in Java.

How to use Queue in Java - Example Tutorial

The JDK provides implementation of several data structure in Java collection framework e.g. ArrayList is a dynamic array, LinkedList represents a linked list, HashMap represents hash table data structure, and Queue interface represent queue data structure. Btw, If you are not familiar with data structure itself then see Introduction to Data Structures & Algorithms in Java, a good course to start with the essential data structure in Java. The Queue data structure allows you to process elements in the first in first out order and that's why it is also known as FIFO data structure. In order to provide first in first out functionality, it allows you to insert data at one end and delete data from other ends, also known as consuming data. If you need to process objects in the FIFO order you can use a Queue to store them.

Top 4 Free Microsoft SQL Server Books - PDF Download or Online Read

Hello Guys, today, I am going to share some of the good database and SQL server books which are freely available on the internet for reading online or download as PDF. If you have been reading this blog then you know that I love books, I love to read books and I love to collect books that's why I have a big online and offline library. Many people question me do I really find to read all books which I share? Well, I don't read all books page by page, unless and until its something like Effective Java or Clean Code. I mostly skim through books and stopping on interesting and new things, which I don't know or probably have a misconception, but I do like to refer books many times. If I skim through a book, I know where can I find more information about a particular concept and then I explore it in more depth.

How to change date format of String in Java 8

One of the common programming task in Java is to change the date format of a given Date or String. For example, you have something like "2017-01-18 20:10:00" and you want to convert it that date into "2017-01-18", or you want to convert from dd-MM-YY to MM-dd-YY or to any other format of your choice and need, but a valid date format as per Java specification. How will you do that? Well, it's not that difficult. It's just a two-step process. In the first step, you need to parse String to create an equivalent date using current format and then once you got the date, you need to again convert it back to String using the new format. The same process is repeated in both Java 8 and before, only corresponding API and classes changes.

How to Create Random Alphabetic or AlphaNumeric String of given length in Java - Example

Suppose, you want to generate an alphabetic or alpha-numeric string of given length in Java? How do you do it? Well, if you are like me, you probably search a library e.g. Apache commons-lang for something which can do this task. It's a good thing. There is no point on re-inventing a wheel if a tried and tested solution already exists. In fact, Effective Java, the most respected book in Java world also suggest to know and use your library. In fact, Apache commons-lang does have a class called RandomStringUtils, which allows you to generate Random alphanumeric String in just one method call as shown below:

RandomStringUtils.randomAlphanumeric(20).toUpperCase();

This works great for many practical purposes but if you are generating security sensitive identifier then this is not 100% secure.

How to add/remove new elements to an array in Java?

Java beginners often ask how to add new elements to an array? or how to remove elements from an array in Java? is that possible in Java? Well, no, it's not possible in Java because arrays length cannot be changed once created. Which means neither you can add new elements nor you can remove an old one. All you can do is that reassign values to the differnet bucket. For example, if you have a String array of length 3 e.g. {"java", "is", "great"} then you can just replace the individual index to make it like {"Python", "is", "great"} by replace "java" with "Python" at first index, but you cannot add or remove elements.

5 ways to Compare String Objects in Java - Example Tutorial

here are many ways to compare String in Java e.g. you can use equals() and equalsIgnoreCase() for equality check and compare() and compareTo() for ordering comparison. You can even use the equality operator == to perform reference based comparison e.g. to check both the String reference variable points to the same object. In general, equals() is used to check whether the value of given String is same i.e. they contain same characters in the same sequence or not e.g. "Groovy".equals("Groovy") will be true if you compare them using equals() method. You can also use equalsIgnoreCase() to check if they are equal irrespective of case e.g. "Apple" and "apple" will be same if you compare them using equalsIgnoreCase() method.

How to convert List into Map in Java 8 - Example Tutorial

One of the common tasks in Java programming is to convert a list to map and I have written about this in past and today we'll see how Java 8 makes this task easier. Btw, be it Java 7 or Java 8, you need to keep something in mind while converting a list to map because they are two different data structure. For example, the list allows duplicate elements but keys in a map must be unique, the value can be duplicated but a duplicate key may cause a problem in Java 8. Similarly, another concern is order. A list is an ordered collection but the map doesn't guarantee any order unless you decide to use LinkedHashMap, which keeps insertion order or TreeMap which keeps mapping in the sorted order of keys. This is one of the important details which many Java beginners forget and then spend hours to chase subtle bugs.

Eclipse IDE - How to Remote Debug a Java Application Running on Linux

The remote debugging of Java program is an ultimate tool in the arsenal of a Java developer, which is often become the last and only tool to investigate a bug on a Java application running on remote host e.g. on Linux server or Windows server. Almost all major Java IDE provides remote debugging e.g. NetBeans, Eclipse, and IntelliJ IDEA, but I mostly use Eclipse for Java coding and so it's my preferred tool to remote debug a Java program. In order to setup remote debugging in Eclipse, you need to do a couple of tasks e.g. you need to start your JVM with debugging parameters or arguments and then you need to create a "remote debug configuration" in Eclipse IDE itself.

Dealing with Files and Directories in Java - 10 Thing Java Developer Should Know

The File API is one of the important parts of any programming language or API and even though Java's file API both new and old, are powerful, they are not intuitive enough compared to other languages e.g. Python. Apart from knowing the essential classes and abstractions e.g. File, InputStream, OutputStream, Reader, Writer, Channel etc, you also need to know and remember some nitty gritty detail to avoid subtle issues. There are many articles out there on the internet which can teach you how to read and write data from the file but there are very few which will tell you to do it in right way.

3 Ways to Generate Random Integers on a Range in Java

Manytimes you need to generate random numbers, particular integers in a range but unfortunately, JDK doesn't provide a simple method like nextIntegerBetween(int minInclusive, int maxExclusive), because of that many Java progarmmers, particularly beginners struggle to generate random numbers between a range e.g. random integers between 1 to 6 if you are creating a game of dice, or random number between 1 to 52 if you are creating a game of playing cards and you need to choose a random card, or most commonly random numbers between 1 to 10 and 1 to 100. Then, the question comes, how to solve this problem? How to generate random int values between a range? Well, you need to do a little bit of work.

Eclipse - Unsupported major.minor version 53.0, 52.00, 51.0 Error in Java

The UnsupportedClassVersionError is a big nightmare for Java developers, probably the next biggest after NoClassDefFoundError and ClassNotFoundException but its slightly easier to solve. The root cause of this error is that your code is compiled using higher JDK version and you are trying to run it on the lower version. For example, the Unsupported major.minor version 53.0 means your code is compiled in JDK 9 (the class version 52 corresponds to JDK 9) and you are trying to run it on any JRE lower than Java 9, probably JDK 8, 7, or 6.

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.