import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=1;i<=t;i++)
{
try
{
long n=sc.nextLong();
if((n>=(-128))&&(n<=127))
System.out.println(n+" can be fitted in:\n* byte\n* short\n* int\n* long");
else if(n>=(-32768)&&n<=32767)
System.out.println(n+" can be fitted in:\n* short\n* int\n* long");
else if(n>=(-Math.pow(2,31))&&n<=(Math.pow(2,31)-1))
System.out.println(n+" can be fitted in:\n* int\n* long");
else if(n>=(-Math.pow(2,63))&&n<=(Math.pow(2,63)-1))
System.out.println(n+" can be fitted in:\n* long");
}
catch(Exception obj)
{
System.out.println(sc.next()+" can't be fitted anywhere.");
}
}
}
}
Why sc.next()
is used in the catch block System.out.println line of code?