HTML

Difference between wait() and join method in Java thread

Though both wait() and join() methods are used to pause the current thread and have a lot of similarities they have different purposes. One of the most obvious differences between the wait() and join() method is that former is declared in java.lang.Object class while join() is declared in java.lang.Thread class. This means that wait() is related to the monitor lock which is held by each instance of an object and join method is related to Thread itself. The wait() method is used in conjunction with notify() and notifyAll() method for inter-thread communication, but join() is used in Java multi-threading to wait until one thread finishes its execution.

How to convert String to char in Java? Example

Earlier, we have seen how to convert a character to String in Java and today we'll learn opposite i.e. converting String to a character. Suppose, you have a String with value "s", how do you convert that to a char 's' in Java (FYI, string literal are quoted inside double quotes in Java e.g. "c" and character literals are quoted inside single quotes e.g. 'c' in J)? Well, if you know, Java String is made of a character array and java.lang.String class provides a method toCharArray() to retrieve that character array. If your String contains just one character then, the only element in character array is what you are looking after. Though that's not the only way to convert a String to char in Java.

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.

How to read file in Java using Scanner Example - text files

Reading file with Scanner
From Java 5 onwards java.util.Scanner class can be used to read file in Java. Earlier we have seen example of reading file in Java using FileInputStream and reading file line by line using BufferedInputStream and in this Java tutorial we will See How can we use Scanner to read files in Java. Scanner is a utility class in java.util package and provides several convenient method to read int, long, String, double etc from source which can be an InputStream, a file or a String itself. As noted on How to get input from User, Scanner is also an easy way to read user input using System.in (InputStream) as source.Main advantage of using Scanner for reading file is that it allows you to change delimiter using useDelimiter() method, So you can use any other delimiter like comma, pipe instead of white space.

What is difference between View and Materialized View in Database or SQL?

Difference between View and Materialized view is one of the popular SQL interview questions, much like truncate vs delete, correlated vs noncorrelated subquery or primary key vs unique key. This is one of the classic questions which keeps appearing in SQL interview now and then and you simply can’t afford to learn about them. Doesn’t matter if you are a programmer, developer or DBA, these SQL questions are common to all. Views are a concept which not every programmer familiar of, it simply not in the category of CRUD operation or database transactions or SELECT query, its little-advanced concept for the average programmer.

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 == and equals() method in Java - String Object

What is the difference between == and equals() method for comparing Objects in Java is one of the classical Interview Questions which appears now and then in many interviews. This question is mostly asked in conjunction with String because comparing String using == and equals() method returns different results. I have often seen as along with other popular String  question e.g. StringBuffer vs StringBuilder, Why String is final etc.  Java is a pure object-oriented language and every object has one state and location in the memory and equals () and == are related to the state and location of the object, now in this article will try to understand this concept and difference between == and equals method in Java.