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.