Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

custom tag  RSS feed

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

while developing the taghandler class we are importing the following packages


i am confused second line in the above code as why importing the second package it is already available to us when import the package in the first line. second package is subpackage of first one so no need to import.but here did.

anybody can clarify my doubt,please?

cheers,
babu.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey babu,
Go to the basics of Java, man. if you import one package the subpackages are not imported.

so if package structure is A.B
A(package)
|
|--X(class)
|--Y(class)
|--Z(class)
|-----B(subpackage)
|
|--P
|--Q
|--R

A contains classes X,Y,Z & B contains classes P,Q,R(shown above)
if you say
import A;//will import X,Y & Z (& not P,Q,R)
import A.B;//will import P,Q & R

I hope this helps otherwise refer any Java Basic Book for more details.
Shrinivas
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to Java in General (beginner)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!