Java Tutorial #4: Data Types and Variables

Published: 01 August 2017
on channel: Pink Code
34
1

Thanks for coming back! In this video we learn about data types and try our luck with a simple program to initiate variables. Data types are specifically used in java to identify the type of value a variable is being assigned (whether it is a number, integer, decimal, word, and its size). There are two types of data types (primitive and non primitive). The primitive data types include Boolean and also different byte value numbers depending on the size and whether it is a decimal or not. Decimals are called floating point integers and the 2 types are float (smaller) and double. The integer primitive values are byte, short, int, and long. The non primitive data types are String for a word or phrase, array for a list, and user defined classes. Assigning a small value to a long creates problems because it uses up too much space on the computer and assigning a long value to a smaller data type such as byte is non compatible since the there is not enough to store the value.

Variables can be changed (unless declared final) and are assigned a value. When initiating a variable write the data type and variable name. By default, initially all variables of data type short, byte, int, long are 0, Strings are null, and Boolean is false. To assign a value to a variable just use the assignment operator (a = sign).
Please subscribe!


On this page of the site you can watch the video online Java Tutorial #4: Data Types and Variables with a duration of hours minute second in good quality, which was uploaded by the user Pink Code 01 August 2017, share the link with friends and acquaintances, this video has already been watched 34 times on youtube and it was liked by 1 viewers. Enjoy your viewing!