Skip to content

Commit 7107224

Browse files
author
AmiyahJo
committed
feat: adds custom exception
1 parent 5ec8ba5 commit 7107224

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.codedifferently.lesson16.amiyahjones;
2+
3+
public class StudentLimitExceededException {
4+
5+
}

lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/amiyahjones/jobReadinessLab.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public int countStudents() {
4545

4646
public void addStudent(String studentName){
4747
students.add(studentName);
48+
try {
49+
throw new StudentLimitExceededException("The classroom is full");
50+
}
4851
}
4952

5053
public void printStudents() {

0 commit comments

Comments
 (0)