You are viewing a single comment's thread. Return to all comments →
JAVA15
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = Integer.parseInt(sc.nextLine()); while (t > 0) { String str = sc.nextLine(); try { Long.parseLong(str); try { Integer.parseInt(str); try { Short.parseShort(str); try { Byte.parseByte(str); System.out.println(str + " can be fitted in:"); System.out.println("* byte"); } catch(Exception e) { System.out.println(str + " can be fitted in:"); } System.out.println("* short"); } catch(Exception e) { System.out.println(str + " can be fitted in:"); } System.out.println("* int"); } catch(Exception e) { System.out.println(str + " can be fitted in:"); } System.out.println("* long"); } catch(Exception e) { System.out.println(str + " can't be fitted anywhere."); } t--; } }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Datatypes
You are viewing a single comment's thread. Return to all comments →
JAVA15
import java.io.; import java.util.;
public class Solution {
}