• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why not get a calendar directly ?  RSS feed

 
Ashish S Yadav
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why have a get instance to get a calendar? Why are we not allowed to use a constructor ?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because class java.util.Calendar is an abstract class, so you cannot directly create an instance of it.

Its most commonly used subclass is GregorianCalendar, but there could in principle be other subclasses that represent other kinds of calendars.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!