• Post Reply Bookmark Topic Watch Topic
  • New Topic

Importing classes into named packages  RSS feed

 
Tom Gibbins
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, i have a simple question

Say i have a project with several different (named, for instance "Greedy_algorithms") packages. I want to import the scanner to one of the classes in the named package, but when i do a simple


The IDE gives me the message: The declared package "" does not match the expected package "Greedy Algorithms". What do i need to do to fix this?

Thanks!
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If you used an IDE to create the package, and then created the class source file under it, the IDE should automatically add the "package" keyword to the top of your class definition. If, on the other hand, you manually have a class source file, created -- then you are responsible to make sure that they match. Make sure your class package declaration matches what the IDE thinks it should be.

Henry

 
Tom Gibbins
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!