importing classes using wildcards

后端 未结 5 1046
太阳男子
太阳男子 2021-01-06 02:18

If I say:

import java.awt.event.ActionListener;

I get the ActionListener Class. If I say:

import java.awt.event.*;
<         


        
5条回答
  •  鱼传尺愫
    2021-01-06 02:38

    java.awt.* is different with java.awt.event.*, the first one will import all the classes within java.awt package, while the second one will import all the classes within java.awt.event, the import function will only import classes, not packages.

提交回复
热议问题