Java Tutorial

Java System In Out Error Example

This example will tell you how to use java standard input, output and error object to read string data from user command line input, write string data to standard output console and display error messages to standard error output. All the standard input or output object is static variable of java.lang.System class.

How To Check If A String Is Numeric In Java

This example show you how to check if a string content is numeric or not. It provide totally six methods to use. package com.dev2qa.calculatorexample; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by zhaosong on 2018/5/23. */ public class CheckStringNumeric { public static void main(String args[]) { CheckStringNumeric checkStringNumeric = new CheckStringNumeric(); checkStringNumeric.isNumeric(“-123.45”); checkStringNumeric.isInteger(“-123”); checkStringNumeric.isIntegerByParse(“-123.456”); checkStringNumeric.isDoubleByParse(“-123.456789”); …

How To Check If A String Is Numeric In Java Read More »

Java DecimalFormat Example

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.

Java TimeZone Example

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.

How To Use Java Code To Set File Permission provide several methods to get or set file permissions in java code. But the drawback of ‘s methods is that it can only separate file permission into two groups which is owner or all users. So java 7 introduce java.nio.file.attribute.PosixFilePermission which provide methods that can let you define file permission more accurately for different …

How To Use Java Code To Set File Permission Read More »