• Post Reply Bookmark Topic Watch Topic
  • New Topic

Constructor for LocalDate  RSS feed

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In the Java doc API : ocs\api\java\time\LocalDate.html
LocalDate shows no constructor,
so does LOcalDate use super Object class constructor ? how does that work ?

Hope someone find my question interesting.
Thanks.
 
Sheriff
Posts: 21136
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the javadocs don't show any constructor, that means you can't initialise it directly; any constructor the class has is either private or package private. However, there are plenty of static methods that you can use to construct a value. The now and of methods are the most used ones.
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that tutorial link tells you anything which can't be found in the Java™ Tutorials, which might be a better link. Another thing worth searching for is descriptions of Yod‍a Time because the newer Java® framework is very similar to it.
The framework's designers have moved from providing public constructors to using factory methods exclusively. You can find the constructors by unzipping the src.zp file which lives in your Java® installation folder and reading the source code. You can learn more about the concept of factory methods in places like Effective Java™ by Joshua Bloch (2/e page 5).

Additional resource: the package summary, which includes a brief description of the classes and a little about the philosophy behind it.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!