Import javax. swing.*; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 16

Import javax. swing.*;

This packge I use but not work why? import javax.swing.*; class simple{ public static void main(String arg[]){ JOptionPane.showMessageDialog(null,"hello"); } }

19th Jun 2019, 5:39 PM
Rajveer Singh
Rajveer Singh - avatar
10 Answers
+ 12
Yaa some operating system it will work....
19th Jun 2019, 6:02 PM
Rajveer Singh
Rajveer Singh - avatar
+ 11
But not give output I also import package write ? But give output memory limit exceeded?
19th Jun 2019, 5:52 PM
Rajveer Singh
Rajveer Singh - avatar
+ 9
Thank you so much 😇 😇
19th Jun 2019, 6:00 PM
Rajveer Singh
Rajveer Singh - avatar
+ 6
Please in detailVikram Joya
23rd Jun 2019, 10:07 PM
Rajveer Singh
Rajveer Singh - avatar
+ 2
If this code is an exact copy, it probably doesn't work because you didn't use the import keyword
19th Jun 2019, 5:45 PM
Airree
Airree - avatar
+ 2
Use JOptionPane inside try catch
23rd Jun 2019, 7:17 PM
vikram Kumar
vikram Kumar - avatar
+ 2
You should use JOpationPane inside the try block then it will work otherwise it's throw an exception or an error
24th Jun 2019, 2:45 AM
vikram Kumar
vikram Kumar - avatar
+ 1
First line should be: import javax.swing.*; Are you doing it here? Using swing on sololearn isn't a good idea.
19th Jun 2019, 5:54 PM
Luk
Luk - avatar
+ 1
It's impossible, swing is about windows, buttons, while sololearn Java is just a console. But don't worry, it will be better for your skills to program on normal operating system.
19th Jun 2019, 5:59 PM
Luk
Luk - avatar
+ 1
Best practices : import specific class -> Import.java.swing.specificClass
20th Jun 2019, 9:01 PM
Dzmitry Dulik
Dzmitry Dulik - avatar