3.2. Keywords

Keywords are reserved words that are predefined in the language and cannot be used to denote other entities. In Java all keywords are in lower case, and incorrect usage results in compilation errors.

See the below table for list of keywords and reserved literals in Java.

			package javatutorial;

			/**
			 * Identify keywords in the below Java class
			 * 
			 * @author f5java.com
			 */
			public class keywordsSample {
				
				private String dayOfWeek;


				public static void main(String[] args) {
					keywordsSample sample = new keywordsSample();
					sample.weeekendCheck("Monday");
					sample.weeekendCheck("Saturday");

				}
				
				public void weeekendCheck(String dayOfWeek){
					if (dayOfWeek.equalsIgnoreCase("Saturday") || dayOfWeek.equalsIgnoreCase("Sunday")){
						System.out.println("Today is " + dayOfWeek + " and it is weekend");
					}else{
						System.out.println("Today is " + dayOfWeek + " and it is Not a weekend");
					}
					
				}

			}