String.format Java

The string format() method in Java returns a formatted string value based on locale, format, and arguments passed. If we do not specify the locale, it takes the default locale from Locale.getDefault(). The extra arguments will be ignored if more arguments are passed. This method is similar to sprintf() method …

Read moreString.format Java

Java Timer – Java Timer Class and Methods for start and cancel timer Schedule and TimerTask using java.util.Timer with examples

Java Timer class executes a task or job in a specific time interval either once or repeatedly. It is part of the Java utility class. This class is also used to schedule jobs on a specified date using its in-built methods. If we want to create our own task, we …

Read moreJava Timer – Java Timer Class and Methods for start and cancel timer Schedule and TimerTask using java.util.Timer with examples

Variables in Java – Java variable types, declare, instance variable, Java variable name rules, and naming conventions

Variables in Java is a memory location that holds a specific value. Before we use any variable, we need to declare it. Every variable is identified with a data type. We will cover data types in the next tutorial. Declaring a variable in Java We can declare a variable in …

Read moreVariables in Java – Java variable types, declare, instance variable, Java variable name rules, and naming conventions

ArrayList Java – How to use java.util.ArrayList class and methods, constructor and iterator with java ArrayList examples

ArrayList in Java is the most commonly used data structure for creating a dynamic size array. It extends the Abstract class and implements the Java List interface. The main difference between array and ArrayList is that the array is static(we cannot add or remove elements) while ArrayList is dynamic(we can …

Read moreArrayList Java – How to use java.util.ArrayList class and methods, constructor and iterator with java ArrayList examples

Java List – Java List Methods – java.util.List – List interface – Java List Example

A Java list or List Interface in Java is a collection or sequence of elements in an ordered manner. Since the list maintains a particular sequence, we can perform any operation like add, delete, get, set on the list using the required index. The index always starts at 0. It …

Read moreJava List – Java List Methods – java.util.List – List interface – Java List Example

Java Substring

Substring() method of String class in Java is used to retrieve a part of the given string. Java Substring method returns a new string based on the index. Substring in Java used extensively for string operations. Java Substring Syntax public String substring(int startIndex, int endIndex); startIndex – The index from …

Read moreJava Substring