DUET PG Score Card 2021
NHAI Recruitment 2021
Bihar Board 12th Dummy Admit Card 2022
RBI Assistant Notification 2021
Jee Advanced 2021 Result
NIACL Assistant Recruitment 2021
SBI PO Online Form 2021

Write a class IsWorkingDay with a main method. The method receives one command line argument which is the name of the weekday

Write a class IsWorkingDay with a main method. The method receives one command line argument which is the name of the weekday.

Write the missing code in the If-else statement such that if the argument passed to the main method is equal to Sunday the program should print Holiday, otherwise it should print Working Day.

For Example:

Cmd Args : Sunday
Holiday

Note: We use public boolean equals(Object anObject) method to check if two strings have the same value. This method will be explained in more detail in later sections.

Solution:

package q10844;
public class IsWorkingDay {
	public static void main(String[] args) {
		//Fill in the missing code using if-else statement
		if (args[0].equals("Sunday")){
			System.out.println("Holiday");
		} else {
			System.out.println("Working Day");
		}

		
		
	}
}

Candidates having any kind of query so he/she can ask in our comment section. Our Panel will b reverting back as soon as possible. Thank You. For more details visit our website (https://speedjobalert.com/)

Leave a Comment