In case of the allocation of the expensive external resources in a BeforeClass method, then there is the requirement of releasing them after the running of the tests completes. For this, the annotation of the @AfterClass method, a public static void method is required to be run after all the class’s tests have been run. It is because of the feature of the method such as it guarantees the test is running even in the situation of an exception thrown by BeforeClass. It is one of the methods to be declared in the superclass and run after the running process of the current class ends. Also, it is called once per test class.

BY Best Interview Question ON 17 Apr 2019