aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes DateFormat question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "DateFormat question" Watch "DateFormat question" New topic
Author

DateFormat question

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186

in order to successfully print that Date, I am trying to fix this code. (question copied from K&B book, chapter 6, p511)

can you help me to fix? this topic is still really confusing me!


boolean b = true;<br />System.out.println ("I believe in Java.<br />Java will make my dream come " + b);
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13869
    
  10

Class DateFormat is an abstract class. You cannot instantiate an abstract class, as you are doing in line 5 of your code. Replace line 5 with something like this:

And you also need to import java.util.Date.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DateFormat question
 
Similar Threads
DateFormat class
How to guess exception
Date format question
date format problem
Time difference