Was confused on this one so an explanation in case anyone else is stuck!
Because case "sat" doesn't have a break statement it then falls through the rest of the cases until it reaches a break. Therefore it hits the case "sun" statement, performs the subtraction of 1 and then breaks.
So as it loops you get: Sun (wd=-1), Mon (wd=-2), Wed (wd=0), Sat (wd=-1)
The answer is the letter C, the compilation fails because the variable "wd" is an instance variable and is not local, instance variables to receive additions of values inside a static method need to be static, as it is not, the code failure.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
MPignaProTech
2 months, 3 weeks agoDriftKing
1 year, 4 months agoakbiyik
2 years, 1 month agoeilla
2 years, 1 month agocarloswork
2 years, 2 months agoiSnover
2 years, 3 months agoUAK94
2 years, 3 months agoiSnover
2 years, 2 months ago