Logo

Learning Java

Start Date: 28-Mar-2020
End Date: 27-April-2020(expected)


Variables


  	
	public static void main(String[] args) {
					
		int myFirstNumber = 5;
		int my2ndNumber = 5 + 10;
		int my3Number = (5 + 10) + (2 * 10);
						
		System.out.println(myFirstNumber);
		System.out.println(my2ndNumber);
		System.out.println(my3Number);
	}

Variables are a way to store information in our computer. Variables that we define in a program can be accessed by name we give them, and computer does the hard work of figuring out where they get stored in the computer's random access memory (RAM).

A variable, as the name suggests can be changed or it's contents are variable. What we have to do is tell the computer what type of information we want to store in the variable and give it a name.


Data Types: There are lots of different type of data we can define in our variables. Collectively these are known as Data types. Data types are keywords in Java. e.g. int -> for integer data types.

Packages are a way to organize Java projects. For now we can consider them as folders. Companies use their domain name reserved.