For Previous Questions: ()
Friends lets try to trace this programs' output and comment your answers
Program 4: Most Commonly asked type and we get confused with this kind of program
Output:
Explanation:
Even though there is a return statement in try block it will execute finally block and then returns control of the program
Program 5: Java Program of Level 2
Output:
Explanation:
In above program we may get confused at the line "int Addition()". We may think that constructor should not have any return value but here it returns int so that the line results in compilation error. But whenever any constructor have return value, compiler treats it as a method. So here program will execute without any compilation Error.
Program 6: Most commonly asked Java Program of Level 1
Output:
Explanation:
Whenever you apply any function on string using String class methods then those methods will returns the modified String but doesn't make any changes to the original String.So if we print Str.replace('S','R') in the above program then it will print "Rita is my aunt" but it doesn't reflects to the original String Str.
0 comments:
Post a Comment