JP Assignment 2$3
JP Assignment 2$3
4. Which of the following allows multiple methods with the same name in a class?
a) Method overriding
b) Method hiding
c) Method overloading
d) Method nesting
18. Which access modifier allows visibility within the same package only?
a) private
b) default
c) public
d) protected
if (true)
System.out.print("Hello");
else
System.out.print("World");
a) Hello
b) World
c) HelloWorld
d) Error
55. Which keyword is used to compare a single variable with multiple values?
a) if
b) else
c) switch
d) compare
java
int i = 0;
while(i < 3) {
System.out.print(i);
i++;
a) 012
b) 123
c) 0123
d) Infinite loop