28 September, 2020

Write a java program to get input from user using Scanner Class.

java scanner class,user input in java,java scanner,example program to take input from user,user input scanner class in java,how to take user input from in java,scanner class,getting input from user in java hindi,how to take input in java,input from user in java,scanner class in java,taking input from users in java,java input using scanner,java programming user input,how to get input in java,using scanner class in java,getting user input java
import java.util.Scanner;
class get_input_from_user
{    
	public static void main(String arg[])
	{
		int i;
		float f;
		String str;
		Scanner obj = new Scanner(System.in);
		
		System.out.print("Enter String:-");
		str=obj.nextLine();
		System.out.println("your String is:-"+str);
		System.out.print("Enter interger number:-");
		i=obj.nextInt();
		System.out.println("your interger number is:-"+i);
		System.out.print("Enter float number:-");
		f=obj.nextFloat();
		System.out.println("your float number is:-"+f);
	}
}
25
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post