aspose file tools*
The moose likes Mock Exam Errata and the fly likes doubts from Sarga mock exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "doubts from Sarga mock exam" Watch "doubts from Sarga mock exam" New topic
Author

doubts from Sarga mock exam

Cristi Tudose
Ranch Hand

Joined: Dec 25, 2000
Posts: 53
1) Given the following class definition:
class A {
protected int i;
A(int i) {
this.i = i;
}
}
Which of the following would be a valid inner class for this class?
Select all valid answers.
a) class B {
}
b) class B extends A {
}
c) class B {
B() {
System.out.println("i = " + i);
}
}
d) class B {
class A {
}
}
e) class A {
}
I select A & C.They said only A.Am I missing something?
Please un adive.
Bhavana Gupta
Greenhorn

Joined: Dec 14, 2000
Posts: 6
class A {
protected int i;
A(int i) {
this.i = i;
}
class B {
B() {
System.out.println("i = " + i);
}
}
public static void main(String args[])
{
B b = new A(10).new B();
}
}
U r right the ans is A C.
the ans they have given are wrong u can try the above code

Find A Purpose In Life So Big That It Will Challenge Every Capacity To Be At Your Best.
Cristi Tudose
Ranch Hand

Joined: Dec 25, 2000
Posts: 53
Thanks a lot Bhavana...
I've already test it and I saw no compile problem but I want to saw another opinion.
Kirti Dhingra
Ranch Hand

Joined: Dec 13, 2000
Posts: 32
b also compiles
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubts from Sarga mock exam