DIFFERENT WAYS OF INPUT METHOD AND TECHNIQUES ON JAVA
1. Scanner Method
2. public String input1()
3. {
4.
System.out.println("enter the input");
5.
Scanner sc=new Scanner(System.in);
6.
String s1=sc.nextLine();
7.
return s1;
8. }
2.
Console Class Method
public String input2()throws IOError
{
3.
{
Console c=System.console();
String s2=null;
s2=c.readLine("enter the value");
return s2;
JOption Method
public String input3()
System.out.println("enter the input");
String s3=javax.swing.JOptionPane.showInputDialog("enter the text");
return s3;
4. BufferedReader Method
public String input4()throws Exception
{
System.out.println("enter the input");
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String s4=br.readLine();
return s4;
}