First of all, you cannot assign System.in directly like that while making an Integer object because it accepts only accepts a
String or an int.
System.in returns the standard input stream which in no way can be directly used to create an Integer object.
You can use a scanner class as suggested by Ankit , or else you read the data using an InputStreamReader chained along with BufferedReader and read the contents from the standard input stream. Something like this:
But when you do this,
you should be careful enough to type in only numbers to the command line. If you type anything other than numbers, NumberFormatException will be thrown at Runtime when it tries to convert the value you entered into Integer.