
Practice Inner Classes –
What will be the output of the program?
public static void main(String[] args) {
Object obj = new Object() {
public int hashCode() {
return 42;
}
};
System.out.println(obj.hashCode());
}
class Boo {
Boo(String s

Practice Inner Classes –
class Boo {
Boo(String s) {
}
Boo() {
}
}
class Bar extends Boo {
Bar() {
}
Bar(String s) {
super(s);
}
void zoo() {
// insert code here
}
}
which one create an anonymous inner class from within class Bar?
Which is true about an anonymous inner class?

Practice Inner Classes –
Which is true about an anonymous inner class?

Practice Inner Classes –
What will be the output of the program?
public abstract class AbstractTest {
public int getNum() {
return 45;
}
public abstract class Bar {
public int getNum() {
return 38;
}
}
public static void main (String [] args) {
AbstractTest t = new AbstractTest() {
public int getNum() {
return 22;
};
AbstractTest.Bar f = t.new Bar() {
public int getNum() {
return 57;
}
};
System.out.println(f.getNum() + " " + t.getNum());
}
}