Commit 4193c6d8 authored by Suresh Kumar's avatar Suresh Kumar

Merge branch 'features/Exception-Handling' into 'develop'

Features/exception handling

See merge request !24
parents dec3f128 4c4a1943
package customclass.com;
class CustomException extends Exception {
String str;
CustomException(String str){
this.str=str;
}
public String toString(){
return ("Message " + str );
}
}
\ No newline at end of file
package customclass.com;
public class UserDefined {
static void validation(String name) throws CustomException{
if (name == null){
throw new CustomException(": Access Denied Due To Username or Password-----> Check Username & Password");
} else {
System.out.println("-------- You Have Successfully Logined-----------");
}
}
public static void main(String [] args){
try {
validation(null);
}
catch (CustomException e){
System.out.println( e);
}
System.out.println("\n------------Custom-Exception---------------");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment