ICSE Class 10 Computer Applications
Question 43 of 43
User-Defined Methods — Question 43
Back to all questions 43
Question Question 41
What is the output of the following code ?
void func(String s) {
String s = s1 + "xyz" ;
System.out.println("s1 =" + s1) ;
System.out.println("s =" + s) ;
}The given code generates error because of the following :
- String s is already declared in the function signature. Its redeclaration inside func() will cause a compile time error.
- String s1 is not declared and that is also a compile time error.