Please take time and answer it correctly and properly.
2. a) What is the role of default and protected access modifier in Java? b) What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor? c) Find out the error of the following Java code. How do you fix the error? public class Test { } public static void main(String[] args) { int x = getValue(); System.out.println(x); } public static getValue() { return 10; }
Please take time and answer it correctly and properly.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am