dimanche 21 décembre 2014

Whats the difference between byte and Byte?


Alright so of course, I know the differences. byte is a primitive and Byte is an object. Byte offers more functions but there is one thing I dont understand. Why would anyone create a variable using Byte? It takes a lot longer. As an example:



byte primitive:
byte mikeHawk = 5;

Byte object:
byte blackHawk = Byte.valueOf((byte)5);


I've been reading a Java book and its teaching me about the object primitives. I mean, its a lot easier to add and subtract with primitives too. Maybe I am missing something. Thanks





Aucun commentaire:

Enregistrer un commentaire