Explain key concepts of Java such as inheritance, polymorphism, and encapsulation, and how they apply to test automation.