help please

M

maitreya

hello im new to this group as im to java. i wanted to clarify this
situation ->

we have a package called A and we have imported it in a class of
package C
now, will all the subclasses of all the classes of package A (may
they be in package A or in any other package) be available to the
importing class of package C.

also tell of a way to importing the if they dont get imported.

kindly respond
 
T

Thomas Schodt

maitreya said:
hello im new to this group as im to java. i wanted to clarify this
situation ->

we have a package called A and we have imported it in a class of
package C
now, will all the subclasses of all the classes of package A (may
they be in package A or in any other package) be available to the
importing class of package C.

also tell of a way to importing the if they dont get imported.

Java import does not affect if a class is available (*)
it is just a compile time convenience feature.

(*) a 3rd party library (jar) needs to be put in the classpath for the
classes it contains to be available.


You don't have to use import - you can write out the path explicitly in
your source code.


java.text.DecimalFormat fmt = new java.text.DecimalFormat("0.0");


When compiled, the bytecode this produces will be indistinguishable from
the bytecode produced for


import java.text.DecimalFormat;

DecimalFormat fmt = new DecimalFormat("0.0");
 
S

Simon Brooke

maitreya said:
hello im new to this group as im to java. i wanted to clarify this
situation ->

we have a package called A and we have imported it in a class of
package C
now, will all the subclasses of all the classes of package A (may
they be in package A or in any other package) be available to the
importing class of package C.

No.
also tell of a way to importing the if they dont get imported.

Import them explicitly.

--
(e-mail address removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/

;; If you're doing this for fun, do what seems fun. If you're
;; doing it for money, stop now.
;; Rainer Deyke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top