Solved programming problem

Create A Dialog Box and Scan String in Java.

Source code

Main Class:

package input;

public class InputTeast 

{

     public static void main(String[] args) 

     {

        Input_P i = new Input_P();

        i.inputPrint();

    }

}

 

 

Input Class:

 

package input;

import javax.swing.JOptionPane; ///for show Dialog box you have to import this

public class Input_P 

{

    public void inputPrint() 

    {   

       String name =  JOptionPane.showInputDialog(null,"Name: ");  ///scan string,

       

       JOptionPane.showMessageDialog(null,"Good Morning "+name+" !!!");  ///print    

       

    }

}

Output

input: sabit

output: Good Morning sabit

Join the discussion

Add your comment