-
-
Static and Non-Static are the two types of nested classes
A) TrueB) False
-
-
What is the output of the following? // A simple example of recursion.class Factorial { // this is a recursive method int fact(int n) { int result; if(n==1) return 1; result = fact(n-1) * n; return result; }} class Recursion { public static void main(String args[]) { Factorial f = new Factorial(); System.out.println("Factorial of 3 is " + f.fact(3)); }}
A) Factorial of 3 is 3B) Factorial of 3 is 6C) Factorial of 3 is 9D) None of the above
-
Java does not supports recursion
A) TrueB) False
-
-
The type of data returned by a method need not be compatible with the return type specified by the method
A) TrueB) FalseExplanation: The type of data returned by a method must be compatible with the return type specified by the method. For example, if the return type of some method is boolean, you could not return an integer
-
Can try statements be nested
Try statements may be tested.