• Post Reply Bookmark Topic Watch Topic
  • New Topic

the Calendar method in java.util is not working  RSS feed

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Please rectify my code.
I am unable to correct the compile time error that  occurs at line no. 12.

error is - Cannot instantiate the type Calendar

 
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first place to look when getting compiler errors from JDK library code is the JDK documentation. For example, if you'd looked at the JavaDoc for the Calendar class you'll have learned very quickly how to obtain a new instance.

Calendar JavaDoc wrote:Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time:
 
Sheriff
Posts: 4931
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@OP
Anyway, what this question has to do with databases (to which forum you posted) ?
 
Sucheta Shrivastava
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim
I tried using the way you told . again i am getting an error - Syntax error on token ")", delete this token on line 5

 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the code you're running is the code you've posted?

Also, is there any reason you're using a JSP to play with Java? Why not just have a plain old Java class?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!