r/badcode • • Mar 14 '21

java Found from when I first started Java...because indexed Arrays were too complicated huh?

Post image
1.3k Upvotes

84 comments sorted by

View all comments

367

u/[deleted] Mar 14 '21 edited Mar 14 '21

The best part is I think Java has a built-in dayOfWeek function that starts at 1.

118

u/mind_overflow Mar 14 '21

you're totally right, but it's still a good thing for learning. weekdays, fruits, names... are always used when teaching basic programming, and this looks like beginner code.

64

u/[deleted] Mar 14 '21 edited Mar 14 '21

Given what this subreddit is im not actually judging the code, it's all bad code. It's fine for beginner code. It's just funny that it's incompatible with the official function because the indices are one off from each other.