why we import both packages java.awt.*; and java.awt.event.*;
as java.awt.*; can import all classes na. then what is the
need of importing java.awt.event.*; ?

Answers were Sorted based on User's Feedback



why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all class..

Answer / shiva

writing java.awt.*; can import only the classes inside it but not its sub packages. so we need to write the sub package also.

Is This Answer Correct ?    20 Yes 2 No

why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all class..

Answer / dhana

As it imports all the classes in java.awt package. It
doesn't import any packages inside java.awt i.e. event package.
So we should declare one more import stat in order to import
all the classes inside event package.

Is This Answer Correct ?    13 Yes 2 No

why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all class..

Answer / hardyesh gupta

java.awt.*; imports the classes available in awt package,but
it does not import packages available in awt.To import the
event package available in awt package, we use the
java.awt.event.*;

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More Core Java Interview Questions

why string is not taking as primitive datatypes but we r taking it as a class? why explain it?

2 Answers   HP, SparkTG,


What is the default value of an object reference declared as an instance variable?

0 Answers  


What is the list interface?

0 Answers  


What are triggers in DB? Explain their types. How do they work?

0 Answers   Amdocs,


what is the replacement for GOTO in java?

2 Answers   CTS,






how can i take the inputs from users in java program?

7 Answers   Wipro,


How to synchonise HashMap

4 Answers   IBM,


Is java map thread safe?

0 Answers  


What does indexof return in java?

0 Answers  


What do you mean by platform independence of Java?

0 Answers  


How do you format in java?

0 Answers  


What is difference between == equals () and compareto () method?

0 Answers  


Categories