CLICK HERE TO EARN MONEY FREE

Sunday, February 3, 2013

input in java


import java.util.Scanner;

class hai
{
   public static void main(String args[])
   {
      int a;
      float b;
      String s;
   
      Scanner in = new Scanner(System.in);
   
      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);
   }
}

0 comments:

Post a Comment

 

TEKONOLOGY Copyright © 2011 -- Template created by TEKONOLOGY -- Powered by Blogger