class Caller{
public void init() {
//private void init() {
System.out.println("Initialized");
}
public void start(){
//private void start(){
init();
System.out.println("Started");
}
}
class TestCall{
public static void main(String[] args){
Caller c = new Caller();
c.start();
c.init();
}
}
Answer is A and D(bcz init and start are private methods). If both public answer will be B(Initialized Started Initialized)
Compilation fails at line n1 and line n2. Since, both the methods are private and are not available outside the class.
So, A and D are the correct answers.
Compilation fails at line n1 because start() has private access in Caller class. "Caller" class IS NOT an inner class because it can be seen from the code block in which the class is declared and IS NOT at the member level of the class TestCall (that is, at the same level as the instance variables, constructors, or methods).
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Hirushi
Highly Voted 2 years agovic88
Most Recent 1 week, 6 days agoMPignaProTech
1 month, 4 weeks agojoeMP
2 months agoarjunrawatirissoftware
1 year, 2 months agogg7495
1 year, 2 months agonamaoo
1 year, 3 months agojebril
1 year, 5 months agofelipegomeztreufo
1 year, 6 months agomrstevebang
1 year, 7 months agoVicky_65
1 year, 8 months agotawa_z58
1 year, 10 months agoAnkit1010
1 year, 10 months agoa_really_reliable_programmer
1 year, 3 months agoDef8
2 years, 1 month agocarloswork
2 years, 1 month agoRoxyFoxy
2 years, 2 months agokkaayyyy
2 years, 3 months ago