Assume that maxtries is a variable of type int that has been declared and given a value. Write an expression whose value is a reference to a newly created Exception object whose message is the string “attempt limit exceeded:” followed by the value of maxtries.

LANGUAGE: JAVA

CHALLENGE:

Assume that maxtries is a variable of type int that has been declared and given a value. Write an expression whose value is a reference to a newly created Exception object whose message is the string “attempt limit exceeded:” followed by the value of maxtries.

SOLUTION:


new Exception("attempt limit exceeded: " + maxtries)