When I try to read a value and print it its not projecting the same i dont understand what is the mistake i am giving the code which i tried to compile
When i try to compile the output is this way
Enter a digit: 1
Entered Value :50
Code:
import java.io.IOException;
class Toread
{
public static void main(String args[])
{
int x;
System.out.println("Enter a digit");
try
{
x= System.in.read();
System.out.println("Entered Value:"+x);
}
catch(IOException e)
{
System.out.println("You had entred wrong value");
}
}
}
Enter a digit: 1
Entered Value :50