+ 1

Why increase the size for integer in java??

15th Jul 2016, 9:49 AM
B.HARSHA VARDHAN KUMAR
B.HARSHA VARDHAN KUMAR - avatar
3 odpowiedzi
+ 1
if you write into a the size is same but when you write integer (int) a the size will increase
15th Jul 2016, 1:37 PM
Hemant Rakesh Gupta
Hemant Rakesh Gupta - avatar
0
didn't get your questions? can you explain it ?
15th Jul 2016, 12:31 PM
Dhiman Das
Dhiman Das - avatar
0
you can't, only if you define your integer unsigned then you can essentially have an integer bigger in size however the reverse is true, you can downcast an int to a smaller value I.e a short but with any sort of casting you run the risk if losing data or precision and therefore all casting should be handled in a try/catch block
22nd Jul 2016, 4:39 AM
Eric Gitangu
Eric Gitangu - avatar