Professional Documents
Culture Documents
*;
Class AcceptData
{
public static void main(String args[])
{
int num;
num = Integer.parseInt(args[0]);
}
}
Import java.util.*;
Class AcceptData
{
public static void main(String args[])
{
Scanner scan=new Scanner(System.in);
Int num;
num = scan.nextInt();
int num;
num= Integer.parseInt(input.readLine());
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
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.