This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

type of import statements?

 
senthil sen
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.import java.packageName
2.class extends java.packageName
3.how can package be imported as an inline statement???
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 2 is not a valid statement. It would need to be:
class MyClass extends java.packageName.ClassName
Import is not the same as include in C++.
Import just provides the namespaces to look in to find the classes that are not qualified. If you fully qualify all of the classes that you use scattered through your code, then you don't need to have import statements at all.
I would NOT recommend this practice. As a matter of fact many shops insist that you list every class that you are importing specifically, just to document what you are using.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic