• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why its giving error even after importing the relevant package?  RSS feed

 
rizwana mujawar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don’t double-space all your code; the additional lines actually make it harder to read.
You ought to tell us more details; how can we help if we don’t know what the error is?
 
Tumelo Labase
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please note, spelling is very important in programming.
 
rizwana mujawar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tumelo Labase wrote:Please note, spelling is very important in programming.


Please be little wise to correct the spelling I have mistaken... Thanks!
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the class you imported and the last but one letter of its name.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you import the proper package for the "Calender" class? I only see you importing the "java.util.*" package, which has no class by that name.
 
rizwana mujawar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:Where did you import the proper package for the "Calender" class? I only see you importing the "java.util.*" package, which has no class by that name.


java.util.Calender is a utililyty class. When i say java.util.*; iam trying to import all the classes in java.util. package...
Iam still unable to debug it.. Can anyone help...!
 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a != e
 
rizwana mujawar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it.. Spelling mistake in Calendar... Thanks to all...
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rizwana mujawar wrote:
fred rosenberger wrote:Where did you import the proper package for the "Calender" class? I only see you importing the "java.util.*" package, which has no class by that name.


java.util.Calender is a utililyty class. When i say java.util.*; iam trying to import all the classes in java.util. package...
Iam still unable to debug it.. Can anyone help...!

yup, I understand all that. This was my attempt to subtly guide to to finding the answer yourself. When the compiler tells you it can't find symbol, the first thing I do is check my spelling. If I am sure that the class I want is in the package, I search the API to be sure - I would literally have gone to the java.util package, and do a cut-n-paste search for "Calender", and would have found it was not there.

In fact, that's what I really did to prove to myself you had a spelling mistake, since I am a horrible speller.
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is such a thing as a calender, but I think is it usually spelt callender. It means a roller, used for example for smoothing things.
What you want in the java.util. package is a calendar. As I said, last-but-one letter.
rizwana mujawar wrote:When i say java.util.*; iam trying to import all the classes in java.util. package...
That is not what the compiler interprets it as. What it does is to look in the java.util. package and import any classes which it can’t identify anywhere else. You would import java.util.Calendar, not List or Set or Random.

You can get problems like thisCannot find Timer. There is in fact a Timer class in java.util. and a Timer class in javax.swing. and the compiler cannot distinguish them without more information! So you get an error.
 
Avinash Oak
Greenhorn
Posts: 15
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change "Calender" to "Calander", then also replace "c" with same, whrever you used them.
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Avinash Oak wrote:change "Calender" to "Calander", then also replace "c" with same, whrever you used them.
Calander???
 
Avinash Oak
Greenhorn
Posts: 15
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. replace "Calender" to "Calendar" and "c.get" to "cal.get" !!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!