Basic HTML version of Foils prepared
9 Sept 1997
Foil 20 Using a Class
From
Java to be used in (Scientific) Computing Part II: Java Language and Object-Oriented Concepts Basic Simulation Track for Computational Science CPS615 --
Fall Semester 97
.
by
Nancy J. McCracken,Geoffrey C. Fox
1
This declares object today to have type class
Date today
2
Date() is Constructor of Date class which constructs an instance of Date class and sets default value to be the current date
new Date()
3
An example application using a method of the Date class:
import java.util.Date;
class DateApplication
{ public static void main ()
{ Date today = new Date();
Date medieval = new Date(1400, 12, 25);
if (today.after (medieval))
System.out.println( "Today is not medieval!");
}}
in Table To:
©
Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu
If you have any comments about this server, send e-mail to
webmaster@npac.syr.edu
.
Page produced by
wwwfoil
on Sun Feb 22 1998