• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DateFormat question

 
adam Lui
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15452
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic