Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Created June 5, 2023 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5AbhishekSaxena/376903da89317bd3fdf8a34941574457 to your computer and use it in GitHub Desktop.
Save 5AbhishekSaxena/376903da89317bd3fdf8a34941574457 to your computer and use it in GitHub Desktop.
class Education(
school: String,
yearOfPassing: Int?,
degree: String? // optional
) {
val school: String
val yearOfPassing: Int
val degree: String? // optional
init {
if (school.isBlank())
throw IllegalArgumentException("School must not be blank.")
if (yearOfPassing == null) {
throw IllegalArgumentException("School must not be blank.")
}
this.school = school
this.yearOfPassing = yearOfPassing
this.degree = degree
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment