Skip to content

Tag: java

What i should return if was an error creating a user

I have a method to create a user, this method check if the username exist and if the password is strong. If the creaton have an error i was returning a exception with a message, but i read this is not an exceptional situation so i don should to use an exception. what should I return to know if the

Regex to consolidate multiple rules

I’m looking at optimising my string manipulation code and consolidating all of my replaceAll’s to just one pattern if possible Rules – strip all special chars except – replace space with – condense consecutive – ‘s to just one – Remove leading and trailing -&#82…

Returning an int array in Java

So I need a script that returns an array of a text document. The document is all numbers. Everytime I try to run it I get this message “This method must return a result of type int[]” this is under the checker part. I am trying to return it to another class so that I can use the array for