Concept

How can you manually throw a generic RuntimeException?

ComputerScienceOne / Throwing Exceptions

"We can also manually throw an exception. For example, we can throw a generic RuntimeException using the following.\n\n1 throw new RuntimeException(\"Something went wrong\");\n\nBy using a generic RuntimeException, we can attach a message to the exception (which can be printed by code that catches the exception). If we want more fine-grained control over the type of exceptions, we need to define our own exceptions."

Related Ideas

How can you manually throw a generic RuntimeException? | ComputerScienceOne | Bifalgorithm | Bifalgorithm