0

This code dose't running with me ... i input the value but no any output ... why?!

import javax.swing.JOptionPane; public class Program{ public static void main(String[] args){ JOptionPane jo = new JOptionPane(); int row = Integer.parseInt(jo.showInputDialog("inter u value")); int coloumn = 0 , line = 0 , cnt = 1 ; while(line <= row){ coloumn ++; line ++; cnt = 1 ; while(cnt <= coloumn ){ System.out.print("*"); cnt++; } System.out.println(); }}}

25th Aug 2017, 3:11 PM
Mohammed Hashim
Mohammed Hashim - avatar
3 odpowiedzi
+ 9
You mean it doesn't run here at the code playground? Swing isn't supported here, just like any other gui framework. Try to take the input via Scanner and System.in.
25th Aug 2017, 3:22 PM
Tashi N
Tashi N - avatar
+ 9
Example for an integer input: Scanner input = new Scanner(System.in); int i = input.nextInt(); To use Scanner you need to import java.util.Scanner. And then you can delete the import of JOptionPane.
25th Aug 2017, 6:29 PM
Tashi N
Tashi N - avatar
0
u mean delete the import javax ....... or edit it to import javax.System.JOptionPan
25th Aug 2017, 3:25 PM
Mohammed Hashim
Mohammed Hashim - avatar