Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Assignments
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
1
Merge Requests
1
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
Commits
4c4a1943
Commit
4c4a1943
authored
May 24, 2022
by
Suresh Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Custom Exception
parent
d821306a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
0 deletions
+33
-0
CustomException.class
.../Exception-Handling/customclass/com/CustomException.class
+0
-0
UserDefined.class
...tion/Exception-Handling/customclass/com/UserDefined.class
+0
-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/out/production/Exception-Handling/customclass/com/CustomException.class
0 → 100644
View file @
4c4a1943
File added
Exception-Handling/out/production/Exception-Handling/customclass/com/UserDefined.class
0 → 100644
View file @
4c4a1943
File added
Exception-Handling/src/customclass/com/CustomException.java
0 → 100644
View file @
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
Exception-Handling/src/customclass/com/UserDefined.java
0 → 100644
View file @
4c4a1943
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