We often need to format numbers, such as taking two decimal places for a number, show only integer part of a number etc. Java provide java.text.DecimalFormat class, which can helps you to format numbers use your specified pattern as quickly as possible.
When you set a date time value in java, you may encounter time zone issue. You will find the date time you get use java.util.Calendar class will always use the system default timezone. This example will tell you how to change it to show date time in your desired timezone.
When you need to invoke java command after install JDK successfully, it is better to setup below Java related system environment variable, they are JAVA_HOME, CLASSPATH, PATH. This article will tell you how to set them up in windows and Linux.
Some times we need to check whether user input a valid number or not. If not, we need to tell user to input a valid number again. In this example, we will show you two method about how to verify a valid number value in a Java String variable.
Java has three character sequence manipulation class. They are java.lang.String, java.lang.StringBuffer and java.lang.StringBuilder. The most popular used class maybe java.lang.String, but there are a lot of difference between them.
Sometimes we need an 2D Array in java. But we do not know the size. So we can not create it at declaration time. An flexible way to do this is first save the data in a java List, then translate the List data to it. In this article we will show you how to …
JUnit is a unit test tool which is open source also. You can use it to test from small units of code to large java functions. JUnit provide assertion library used to examine the result of the test. Junit Annotations are used to test java method. You can also use it to run the automation suite …
Java I/O(Input/Output) handles the task for getting data from a source or saving data to a target. Packages java.io and java.nio is used to handle I/O issues. In this topic we will give you a general overview about the two packages and introduce new features in java.nio.
If you have a good and effective understanding of Java variables and data types then you can make your programming skills excellent. In this chapter we will introduce basic java variables and data types with easy understanding code examples to you.