• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using GregorianCalendaer class  RSS feed

 
Roger Fed
Ranch Hand
Posts: 82
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I've developed the code below for this problem "Java API has the GregorianCalendar class in the java.util package that can be used to obtain the year, month, and day of a date. The no-arg constructor constructs an instance for the current date, and the methods get(GregorianCalendar.YEAR), get(GregorianCalendar.MONTH), and get(GregorianCalendar.DAY_OF_MONTH) return the year, month, and day. Write a program to test this class to display the current year, month, and day."
But it give me Wrong result

the output is
Year:1
Month:2
Day:5
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the methods get(GregorianCalendar.YEAR), get(GregorianCalendar.MONTH), and get(GregorianCalendar.DAY_OF_MONTH) return the year, month, and day.

You're not calling the get method.
 
Roger Fed
Ranch Hand
Posts: 82
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you tell me how can i call these methods???
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you call a method of an object ?
 
Roger Fed
Ranch Hand
Posts: 82
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i resolve it
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!