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

Can we override the main method?

4 Answers  


Why runnable interface is used in java?

0 Answers  


What is the use of Getters and Setters method ?

4 Answers  


What is difference between call by value and call by reference?

0 Answers  


Define an applet in java?

0 Answers  






what is the difference b/w PUT and POST method to send data to the server

5 Answers   Mind Tree,


Is a char always 1 byte?

0 Answers  


What is the purpose of the enableevents() method in java programming?

0 Answers  


What are the limitations of procedural programming approach?

0 Answers   Amdocs,


How are variables stored?

0 Answers  


What are the benefits of operations?

0 Answers  


When should we create our own custom exception classes?

0 Answers  


Categories