Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot apply...wrong type or wrong operator?help please!

 
Selecta Zhangy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



im trying to do"type 1 then shows the calendar" program, but it keep jumping error!:"setcalendar(int) in calendar cannot be applied to()"!!!

anyone explain it to me and tell me how to correct it please! thanks!
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're refering to the setcalendar(int year) method without supplying a integer value. If this is not needed you could overload this method where there is no integer value needed.
 
Selecta Zhangy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, but im still confusing, more help(especially the way how to solve it) please...
[ March 21, 2007: Message edited by: Selecta Zhangy ]
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What it means is that the method expects you to send an int.
 
Selecta Zhangy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Keith Lynn:
What it means is that the method expects you to send an int.


thanks, yes i know.
but how do i make the calendar an int???the calendar class is holding different variables , how can itself be an int???its so complex...
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not trying to make a Calendar an int. The method you are trying to call expects you to send an int. The name of the parameter suggests that you should send an int indicating the year.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to make the calendar an int. In this code
you are calling the setcalendar() method. However, the setcalendar method is declared as
which means you need to pass an integer value which represents a year. So, as an example, to pass this year as an argument, you change your code to
 
Selecta Zhangy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem sovled!!!thanks everyone!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic