Java Programming PROBLEM:
DIFFERENT DATATYPES
Write a program to ask the user to enter an int, float, char, string, long and boolean data type values and to print its value.
Input and Output Format:
Refer Sample Input and Output for formatting specifications.
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output]
Hint:
Use String format() method or Math.round() method - for all floating point values displayed correct to 2 decimal place.
Enter integer
56
Enter float
56.65
Enter character
A
Enter string
Java
Enter long
12345678910
Enter boolean
true
56 is an integer value
56.65 is a float value
A is a character value
Java is a string value
12345678910 is a long value
true is a boolean value
DIFFERENT DATATYPES
Write a program to ask the user to enter an int, float, char, string, long and boolean data type values and to print its value.
Input and Output Format:
Refer Sample Input and Output for formatting specifications.
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output]
Hint:
Use String format() method or Math.round() method - for all floating point values displayed correct to 2 decimal place.
Enter integer
56
Enter float
56.65
Enter character
A
Enter string
Java
Enter long
12345678910
Enter boolean
true
56 is an integer value
56.65 is a float value
A is a character value
Java is a string value
12345678910 is a long value
true is a boolean value