|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details
|
Do you have paypal account? Click Here to pay now and get the questions.
|
|
SCJP 5.0 Objective - 5(10 Questions)
1) What do you infer from the following program?
package scjp5_0.chap05;
public class Ques01 {
public static void main(String[] args) {
Manager manager = new Manager();
TeamMember member = new TeamMember();
member.rating = 10;
}
}
class Manager{
private int rating;
public void doWork(){
}
}
class TeamMember{
public int rating;
public void doWork(){
}
}
- The classes enjoy rich loose-coupling.
- The classes are poorly designed as there is a good possibility of making relation-ship through inheritance.
- Both the classes Manager and TeamMember should be made final.
- The variable rating in the class TeamMember should be made private.
- The variable rating in the class Manager should be made public.
Answer
1) b and d.
Answer b is correct since both Manager and TeamMember are both employees and there is a possibility of a class called 'Employee' standing as the base for both Manager and TeamMember. Generally, a variable shouldn't be made public as it is violating the principle of encapsulation. So option d is also correct.
|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|