Java question. | Sololearn: Learn to code for FREE!

+1

Java question.

Hi CAN SOMEONE TELL ME IF I AM CORRECT SO IF DO Import jAVAx.SWING.JOPTIONPANE <= SO THIS GONNA IMPORT THE LIBRARY BUT IF I DO IMPORT JAVAX.SWING.* <= WOULD THIS DO THE SAME THING

4/10/2021 6:11:50 AM

Shubham

4 Answers

New Answer

+9

import javax.swing.JOptionPane imports only the JOptionPane class in javax.swing package but if you do import javax.swing.* all classes in javax.swing package will be imported. The asterisk (*) is a wildcard that imports all classes.

+3

there are also packages with similar names that must be imported separately import javax.swing.*; import javax.swing.text.*;

0

0