Output writing for Data Type Size – Computer Sir Ki Class
  

Login
[lwa]



Solved Problem! #JAVA#3857    siteicon   siteicon  

Problem Statement - Output writing for Data Type Size

Data type size determination

TC++ #3857

class SP_DataSizes
{
public static void main(String[] args)
{
Integer n=12;
Double d=12.0;
Float f=12.0f;
Character c=12;
Short s=12;
Long l=12L;
Byte b=12;
System.out.println(n.SIZE);
System.out.println(d.SIZE);
System.out.println(f.SIZE);
System.out.println(c.SIZE);
System.out.println(s.SIZE);
System.out.println(l.SIZE);
System.out.println(b.SIZE);
}
}

Test it !

Solution


Run Output

32
64
32
16
16
64
8

Since the SIZE field can be used only with the wrapper class version of primitive types the program has been written in the given way.

Common Errors

  • Care needs to be taken for Long type which needs a L suffix.


Suggested Filename(s): BooleanType.java



Share

sunmitra| Created: 20-Mar-2018 | Updated: 20-Mar-2018|






Back