• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class Path  RSS feed

 
shweta patiljadhav
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

According to
Mala Gupta
book,



will compile but



won't complie....
please explain why?
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The import example means that there are two things, both named "Date". By using the import statement you can use only "Date" when declaring a field instead of "java.util.Date" or "java.sql.Date". Just a shorter form. If there are two things with the same name the compiler cannot know which one you want to use. By using "java.util.Date date1" and "java.sql.Date date2" the compiler knows which one to use.
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a Java7 question. Moving discussion.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!