Quest Global interview question

Java code with all oops concept