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(); }}}
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.
+ 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.
0
u mean delete the import javax ....... or edit it to
import javax.System.JOptionPan