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.
You actually don't need the last if statement in your code.
The variable 'x' is initialized as a long. If it initializes successfully, then we already know it fits in long. If it doesn't fit in long, an exception will be thrown at the initialization statement, prompting the catch statement which prints out that it can't be fitted anywhere.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Datatypes
You are viewing a single comment's thread. Return to all comments →
You actually don't need the last if statement in your code.
The variable 'x' is initialized as a long. If it initializes successfully, then we already know it fits in long. If it doesn't fit in long, an exception will be thrown at the initialization statement, prompting the catch statement which prints out that it can't be fitted anywhere.