Sapient Company Programming

What should be the access specifiers for function Bob() in the following code snippet so that the program doesn't get compiler error?

class Base{
---1--- void Bob(){}
}

class Derived extends Base{
---2--- void Bob(){}
}

public class Main{
public static void main(String args[]){
Derived d = new Derived();
}
}

1) 1=public 2=protected
2) 1=public 2=private
3) 1=private 2=public
4) 1=private 2=protected

Read Solution (Total 1)

Sapient Other Question

Which of the following statements is/are correct regarding inheritance in Java?

A. Private methods cannot be overridden.
B. Inherited classes are not accessible outside a package.
C. Protected methods are final while private methods are not.

1) Statement A is wrong
2) Statement B is wrong
3) Statement C is correct
4) Statement B is correct but Statement C is wrong.
Which of the following funcations would return layout of a fragment, assuming that funcation is implemented in the fragment class?

1) onCreate()
2) onFragmentView()
3) onView()
4) onCreateView()