Java Program To Get Input From User

import java.util.Scanner;
class GetInputFromUser
   public static void main(String args[])
      int a;
      float b;
      String s;
      Scanner in = new Scanner(;
      System.out.println("Enter a string");
      s = in.nextLine();
      System.out.println("You entered string "+s);
      System.out.println("Enter an integer");
      a = in.nextInt();
      System.out.println("You entered integer "+a);
      System.out.println("Enter a float");
      b = in.nextFloat();
      System.out.println("You entered float "+b);   
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Web Developer, Student and Mechanical Engineer. He Enjoys writing articles, Blogging, Solving Errors and Social Networking. Feel Free to let me know any of your concerns about hacking or let me know if you need any more methods on hacking anything. Enjoy Learning

No comments:

Post a Comment