User Input Operation in Java Language?

1  Using


   PrintStream                         InputStream

  print()                                    read()


out is the reference variable of PrintStream Class :-

in is the reference variable of InputStream Class.

read() has two major limitation

1)  throw Exception

2)  return byte data for single char

these problem  has been solved by Scanner class because Scanner convert input data into Object pattern.

Scanner   sc = new Scanner(;

this class provide predefine method to typecast data into different datatype.

int a = sc.nextInt();

float b = sc.nextFloat();

String s =;

char ch =;

double d = sc.nextDouble();


WAP to create Salary Calculator where basic,ta,da,comm,pf,leave,advance salary will be entered by the user .display Gross Salary and Net Salary of employee.

WAP to  reverse five digit number where first and last digit will be same .(without loop)

45123  o/p  42153

WAP to  convert temperature from Celsius to Fahrenheit ? 


2 Using Command Line 

Post a Comment


POST Answer of Questions and ASK to Doubt

Post a Comment (0)