Correct Answer: Local class is class defined inside method EX; class A { // top level class public static void main(string[] args) { class B { // local class } } }
Correct Answer: Non-static member class is a class defined inside outer class with out static modifier EX: class A { // top level class or outer class class B { //non-static member class } }
Correct Answer: Static member class is a class defined inside outer class with static modifier EX: Class A { //top level class or outer class static class B { //static member class } }
Correct Answer: The wait(), notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource When a thread executes an object's wait() method, it enters the waiting state It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods
Correct Answer: new ClassName(); This expression creates object in heap area and returns that obj address Here JVM creates object but JVM does not returns object original address JVM returns duplicate address, duplicate address is also called as hashcode
Correct Answer: This is a keyword and used as reference to Current object address in java It means by using which object the method is called that object hashcode is stored inside the 'this'
10. When this. non-static datamember is compulsory inside non-static method
Correct Answer: Whenever there is local- variable/parameter inside the method with same name as data member Ex: Class Sample { int a; void show() { int a=5; systemoutprintln(a); // 5 systemoutprintln(thisa);//23 } } class MainApp { Public static void main(String[] args) { Sample s = new Sample(); sa = 23; sshow(); } }