Variables

Instead of using a string literal to display the message "Hello World" we can use a String variable instead.

1
2
3
4
5
6
7
8
9
package hello;

public class Greetings {
	public static void main(String[] args) {
		String greeting="Good morning";
		String students="students";
		System.out.println(greeting+" "+students);
	}//main
}//Greetings
CODE
Good morning students

NEXT: