Tuesday, 2 December 2014

Benefits of data types

When using a programming language, there are lots of different data types you can use and each data type has its own advantages but also its disadvantages. Here is a list of each data type:

  • Boolean- This data type can only be true or false answer. 
  • Char- This data type can contain one character. 
  • String- This data type has the capability of storing multiple characters and punctuation. 
  • integer- There are a few different types of data types for numbers, there is float, double and int. These data types allow you to do things like equations, for example things like simple addition or even more complex things like areas of certain shapes etc...
  • Object- Any data type may be stored as a object, this is helpful if you are thinking of later on changing them into a different data type using certain codes like: "Integer.parseInt".

Having lots of these different data types allows multiple functions while using less memory in order to run them. Knowing the various data types also allows for a easier debugging process as you will know the exact amount you can place in each data type, for example you wouldn't try and place more than one character inside of a char, this will cause an error, stopping the program. Therefore you would know that you had to use a string instead.

No comments:

Post a Comment