Barclays interview question

Testing basic questions and Java oops concepts