We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My quippy answer is that it's there to make Java developers happy.
My more serious answer but related answer is that it doesn't follow value semantics. Classes in Java don't have value semantics, all objects are referred to by reference, so you have to assign a reference to something.
This task follows a Java style of only having methods in a class, even if that class has no state and one function, that's just what Java allows.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 17: More Exceptions
You are viewing a single comment's thread. Return to all comments →
My quippy answer is that it's there to make Java developers happy.
My more serious answer but related answer is that it doesn't follow value semantics. Classes in Java don't have value semantics, all objects are referred to by reference, so you have to assign a reference to something.
This task follows a Java style of only having methods in a class, even if that class has no state and one function, that's just what Java allows.