-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consulta y ejercicios de excepciones - Maicol Llano #21
base: master
Are you sure you want to change the base?
Consulta y ejercicios de excepciones - Maicol Llano #21
Conversation
@@ -0,0 +1,24 @@ | |||
public class Main { | |||
|
|||
public static void main(String args[]){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este ejercicio ya lo subieron 🍂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Debo subir otro, entonces ?
CustomExcep.java
Outdated
|
||
public static final long SerialVersionUID= 500L; // Este es un ID que JAVA requiere para manejar la excepcion en el Runtime | ||
|
||
public CustomExcep(String mensaje){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mezcla de español e inglés 🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿ Profe, por qué lo de SerialVersionUID está mal ? Yo lo puse porque en el tutorial que vi explicaban que se debía poner siempre.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esta mal, porque ya alguien subio un ejemplo con ese mismo código. La idea era inventarse su propio ejemplo. 🚧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Puedo agregar más cosas al código o entonces subo un ejemplo totalmente diferente ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lo podes tomar de referencia, pero adaptarlo mucho. La decisión depende de vos, lo que te quede mejor. 🚧
// (?=.*[A-Z]) -> contenga una letra mayúscula | ||
// {6,16} -> tenga una longitud entre 6 y 16 caracteres | ||
|
||
String regExp1 = "(.{6,16})"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo lo relacionado a miembros datos debe ir en un contructor o en un método, no se recomienda asignar valores a miembros datos, la única excepción son las constantes.
Verifier.java
Outdated
if(!pass.equals(passrepeat)){ | ||
throw new CustomExcep("Los campos de contraseña no son iguales"); | ||
} | ||
|
||
if(pass.length() <= 8){ | ||
throw new CustomExcep("La contraseña es demasiado corta, ingrese una mayor a 8 caracteres"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Los mensajes de la excepción personalizada deben ser datos constantes definidos en una clase de constantes.
Hay conflictos por resolver 🚧 |
No description provided.