Scanner Class in Java
This is presumably the most favoured technique to take input. The primary reason for the Scanner class is to parse primitive composes and strings utilizing general expressions, in any case, it can utilize to peruse contribution from the client in the order line.
Code:
import java.util.Scanner;
class Input1
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int i,j;
String b;
System.out.println("Enter length of rectangle");
i=s.nextInt();
System.out.println("Enter breath of rectangle");
j=s.nextInt();
System.out.println("Enter Gender");
b=s.next();
System.out.println("Area of rectangle is"+(i*j));
System.out.println("Gender is"+b);
}
}
Result:
0 Comments