Webcam Chat QuickBooks Advice international calling cards international phone cards
JavaBeat Certifications Certifications Kits Articles Tutorials Tips QNA Book Store Interview Questions SCJP 1.5 SCJP 1.6 SCWCD 5.0 SCBCD 5.0 SCEA SCJA Feeds
Kaspersky Anti-Virus 2011
350 Mock Questions on SCJP 1.5 - JUST Rs.250 or 7 USD
Send us mail to sales@javabeat.net
more details
01. MockExam - 01 02. MockExam - 02 03. MockExam - 03 04. AutoBoxing - 1 (10 questions)
05. AutoBoxing - 2 (10 questions) 06. Generics 1 - 6 Questions 07. Generics 2 - 7 Questions 08. Generics 3 - 10 Questions
09. Generics 4 - 10 Questions 10. Generics 5 - 10 Questions 11. Generics 6 - 10 Questions 12. Enum 1 - 10 Questions
13. Enums 2 - 10 Questions 14. Enums 3 - 15 Questions 15. Var Args 1 - 10 Questions 16. Var Args 2 - 10 Questions
17. SCJP 5.0 Mock Questions -1 18. Declaration,Access Control-1 19.Java File IO Package - 1 20.Java File IO Package - 2
21.Language Features - 1 22.New Api's - 1 (10 questions) 23.New Api's - 2 (12 questions) 24.Objective - 1 (20 questions)
25.Objective - 2 (10 questions) 26.Objective - 3 (10 questions) 27.Objective - 4 (10 questions) 28.Objective - 5 (10 questions) 29.Objective - 6 (10 questions) 30.Objective - 7 (10 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(){
	}
}
  1. The classes enjoy rich loose-coupling.
  2. The classes are poorly designed as there is a good possibility of making relation-ship through inheritance.
  3. Both the classes Manager and TeamMember should be made final.
  4. The variable rating in the class TeamMember should be made private.
  5. The variable rating in the class Manager should be made public.

Get more questions on SCJP 1.5 topics

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.250 or 7 USD
Send us mail to sales@javabeat.net
more details

JavaBeat Website (2004-2009), India
javabeat | advertise | about us | useful resources
Copyright (2004 - 2009), JavaBeat