Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
In every OOP language, it's good practice to enforce that objects have always valid state and in this example a Student missing first name, last name or student number would probably not be considered valid and constructing such an invalid Student should fail fast. Having Yoda style code instead feels unnatural and is difficult to read. But there are always at least two different opinions on a topic. ;-)
resolved!
Description updated!
@jayeshcp check if you can close the issue!
true, in this case the presented solutions did't check for the case that student is null as well - so the .getFullName() will present an error on itself.
In Java, it's good practice when testing String equality to put the String constant on the left:
...instead of...
This way, if
student.getFullName()
returnsnull
, you'll getfalse
instead of throwing aNullPointerException
.This comment is hidden because it contains spoiler information about the solution
Thanks for good advice. Tryed my best to fix it.
Please correct spelling mistakes