Missed day of the week

This week there will be an important delivery of your entire team. You clearly remember your team manger telling you about it. The only thing you forgot is the day of the week when the delivery will take place.You asked six of your team members about the delivery. None of them knew the day when it will take place, but each of them remembered one day when it will not take place. The days they remembered were distinct. For a clever coder like you, this was enough to determine the day of the meeting.You are given a String[] notOnThisDay containing six weekdays when the meeting will not take place. Return the weekday of the meeting.

Method: public String getDay(String[] notOnThisDay)

1)i/p=>{“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”}, o/p=> “Saturday”.

2)i/p=>{“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Friday”, “Thursday”}, o/p=> “Saturday”.

3)i/p=>{“Sunday”, “Monday”, “Tuesday”, “Thursday”, “Friday”, “Saturday”}, o/p=> “Wednesday”.

4)i/p=>{“Sunday”, “Friday”, “Tuesday”, “Wednesday”, “Monday”, “Saturday”}, o/p=> “Thursday”.

import java.util.Arrays;
public class WhichDay {
    public String getDay(String[] notOnThisDay) {
        String[] theDays = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
        String theday  = "";
        for (int i =0;i<theDays.length;i++) {
        return theday;

    public static void main(String[] args) {
        WhichDay wh= new WhichDay();
        wh.getDay(new String[] {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"});

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: