X1155: Throwing an Exception The method below takes in a String parameter representing a username. It should
Fantastic news! We've Found the answer you've been seeking!
Question:
X1155: Throwing an Exception
The method below takes in a String parameter representing a username. It should throw an Exception if the username is less than 3 characters long. The method correctly throws the exception, but something is still missing. Fix the problem.
public String validateUser(String userName) { if (userName.length() < 3) { throw new Exception("userName is too short"); } return userName; }
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: