You are on page 1of 7

Import java.lang.

*;
Class AcceptData
{
public static void main(String args[])
{

int num;

num = Integer.parseInt(args[0]);

System.out.println(“U Entered Num is : “+num);

}
}
Import java.util.*;
Class AcceptData
{
public static void main(String args[])
{
Scanner scan=new Scanner(System.in);

Int num;

num = scan.nextInt();

System.out.println(“U r Entered :”+num);


}
}
Import java.io.*;
class AcceptData
{
public static void main(String args[])
{
BufferedReader input=new BufferedReader(new
InputStreamReader(System.in));

int num;

num= Integer.parseInt(input.readLine());

System.out.println(“U Entered :”+num);


}
}
Wrapper classes are special classes. That are used to make
primitive variables into an objects. and to make wrapped
objects into primitives. int, Boolean, double are all primitive
data types and their respective wrapper classes are Integer,
Boolean, and Double.

byte Byte
short Short
int Int
float Float
double Double
char Char
boolean Boolean
Wrapper class not only alone to convert primitive value into
object But also come with a number of Utility methods.
Which allowe to use convert one datatype to another
datatype easily. One method available in all be wrapper
classes is parse XXXX method. Which allows the
programmer to convert a string into the corresponding
primitive datatype. Provided the string contains a valid
primitive value. In case the string been converted doesn't
contain valid value then the parse method raises on
Exception called NumberFormatExcetion
Scanner class is the fastest , easiest way to get input from a
user in java. You should also be able to store data inside of
variables. To use the Scanner class, pass the InputStream
object to the constructor as shown below

Scanner input=new Scanner(System.in);

METHODS DESCRIPION
nextByte() Return the next token as a byte value.
nextInt() Return the next token as a int value.
nextFloat() Return the next token as a float value.
nextLong() Return the next token as a long value.
nextDouble () Return the next token as a double value.
nextLine() Return the next token as a string.

You might also like