Series: java util

classes of package java.util like Date, Calendar, Random explained with programs and screenshots in simple terms

Deprecation Meaning

What is Deprecation Meaning? "Deprecation", warning raised, by the Java compiler, is very common to a Java programmer. It is raised when the programmer uses a method that is found faulty or problematic. A substitute method will be available in the later versions. For example, readLine() method of DataInputStream was deprecated in JDK 1.1 and …

Deprecation Meaning Read More »

class Date Methods

class Date Methods Summary: By the end of this tutorial "class Date Methods", you will come to know how to use Java Date class methods. Introduction to class Date Methods java.util.Date class constructor is used to print the system date. It comes with many methods to manipulate the date. But these methods are deprecated in …

class Date Methods Read More »

class GregorianCalendar

GregorianCalendar is a concrete class, a subclass of abstract class Calendar. The GregorianCalendar class represents the calendar we use everyday. It is used to manipulate date and retrieve date particulars. This was introduced with JDK 1.1. Following statement gives the class signature public class GregorianCalendar extends Calendar Following program illustrates the usage of a few …

class GregorianCalendar Read More »

class Random Generate random numbers

class Random Generate random numbers Summary: By the time you complete this "class Random Generate random numbers", you will understand of how to generate random numbers in Java. Introduction to class Random Generate random numbers Generating different numbers at different times of execution, by the same program, is known as random number generation. Random numbers …

class Random Generate random numbers Read More »

StringTokenizer Tokenizing String

After knowing the data structures from java.util package, let us discuss about the remaining classes of java.util package. The classes include Date and GregorianCalendar to manipulate dates, Random class to generate random numbers and StringTokenizer to separate the string into individual words (known as tokens). The other classes less used are Observer, Observable, Timer and …

StringTokenizer Tokenizing String Read More »

Timer TimerTask Java

Timer TimerTask Java Introduction The classes, Timer and TimerTask from java.util package, introduced with JDK 1.3, are used with threads to animate the images at regular intervals of time. If the stipulated (delay) period of time is over, the Timer object can generate events. Simply by handling the event, the programmer can execute some user-defined …

Timer TimerTask Java Read More »