• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

custom tag

 
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
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to Java in General (beginner)
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic