Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
assignments_new
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Suresh Kumar
assignments_new
Commits
d44c06f8
Commit
d44c06f8
authored
Jun 28, 2022
by
Suresh Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exception-Handling
parent
6c965654
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
CustomException.java
Exception-Handling/src/customclass/com/CustomException.java
+11
-0
UserDefined.java
Exception-Handling/src/customclass/com/UserDefined.java
+22
-0
No files found.
Exception-Handling/src/customclass/com/CustomException.java
0 → 100644
View file @
d44c06f8
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
Exception-Handling/src/customclass/com/UserDefined.java
0 → 100644
View file @
d44c06f8
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---------------"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment