import java.io.DataInputStream;
class Reading
{
                public static void main(String args[])
                {
                                DataInputStream in=new DataInputStream(System.in);
                                int a=0;
                                float b=0.0f;
                                try
                                {
                                                System.out.println("Enter An Integer : ");
                                                a=Integer.parseInt(in.readLine());
                                                System.out.println("Enter A Float : ");
                                                b=Float.valueOf(in.readLine()).floatValue();
                                }
                                catch(Exception e)
                                {
                                }
                                System.out.println("Integer = "+a);
                                System.out.println("Float = "+b);
                }
}

JAVA 7

Advertisements