java.util

How to use Observer and Observable in Java?

Two classes exist in java.util package to get informed whenever an object changes its properties. The class which you would like to observe (like a Student object) should extend Observable and the class which would like to keep a vigilance (like Principal) should extend Observer. One program using both the classes with explanation is given …

How to use Observer and Observable in Java? Read More »

What is Date, Calendar in Java?

Date and Time manipulation is a must in every programming. Date, GregorianCalendar, SimpleDateFormat classes placed in java.util package comes to the rescue for all possible operations on date and time. Following postings of this same Web site give all the possible operations on Date and Time manipulations. 1. class Date 2. class GregorianCalendar 3. SimpleDateFormat …

What is Date, Calendar in Java? 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 »

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 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 »

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 »

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 »