Logo

Learning Java

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


Statements, Whitespace and Indentation (Code Organization)


	package lectures;

	public class StatementWhiteSpacesAndIndentation {

		public static void main(String[] args) {
			
			int myVariable = 50;
			myVariable++;
			myVariable--;
			System.out.println(myVariable);
			System.out.println("This is a test");
			System.out.println("This is" + //Whitespaces
			" another " +
					"still more");
			
			int anotherVariable = 50;myVariable--;System.out.println("This is another one");
			//Now no whitespace
		}
	}

Explanation:

myVariable = 50 is an expression
int myVariable = 50; is a statement
Methods are also statements
Indentation: is indenting a code so that it is more readable