import java.io.*; // import java.io package
public class Class1
{
// We need to add 'throws java.io.IOException' to our main function
// to be able to use System.in.read() for our keyboard input
public static void main (String [] args) throws java.io.IOException
{
int value = 0; // variable that will hold the input value
// display a question
System.out.print("How many computers do you have? (Type in an integer)\n");
value = System.in.read(); // input
System.out.println("You have " + (char)value);
}
}
// This tutorial displays the first use of java input, using System.in.read()
Download Java Source Code
I hope you found this java tutorial useful!
Don't forget to mention Apron Tutorials in your References!