Data Types - The Real Basics
-
22-07-2019 - |
Question
I would say I'm pretty new to this but could someone explain the basics about data types, more specifically Integers, characters, boolean, string and floating-point numbers.
Solution 4
Types or datatypes say what kind of information you are able to store in a variable.
It is like you will assume that you have in your pocket a wallet with datatype "money", thus you are able store "money" there but not "keys".
Example datatypes:
Integer can store whole numbers: 5 12937 1298273
can't store number with fractional part: 123.43 234.534634643 12452352.1235
can't store strings: "hello" "nice to meet you"
floating point can store whole number and this with fractional part: 5 12937 1298273 123.43 234.534634643 12452352.1235
can't store strings: "hello" "nice to meet you"
Characters can store single chars: "a" "n" "d"
can't store whole strings: "hello" "nice to meet you"
Boolean can store logical values, logical value answers the question if something is: True False
Physically booleans can be represented in different wayy: True could be 1 or any value except 0 and False can be 0 (like in C like languages)
OTHER TIPS
The Primitive data type on Wikipedia seems to be a good starting point.
For which programming language? For Java, you can find a good introduction and overview in the lessons Primitive Data Types and Numbers and Strings of Sun's Java tutorials.
No doubt someone will provide a good run down of these types however you could simply read this:-