Skip to main content

Posts

Showing posts from May, 2018

Variables, Data Types and Literals in Java

Hi! Lets continue with our next topic! VARIABLES What is a Variable? A variable is just like a bottle. A bottle can contain only liquid and it can be of any type i,e, water, juice, milk, etc. For example, a bottle is of size 1 ltr. and filled with water. Note that the type and quantity of liquid is now determined i.e. the bottle can contain only 1 ltr. of water and not more than that.Similarly, a variable is a fixed size container depending upon its data type.. It also compulsorily has a name. There are some naming conventions which will be discussed later on! (camel case). Let's see the types of variables! There are three types of variables : Local / Global variables Instance / reference variables Static variables DATA TYPES What are Data Types in Java? Java is a strongly typed language i.e. a variable needs a data type before it holds some data. If you want to fill a container and you dont know what is going to filled in that container, java compiler...