What do the following functions return? String x = "Vision"; String y = "2020"; i) System.out.println(x + y); ii) System.out.println(x.length()); iii) System.out.println(x.charAt(3)); iv) System.out.println(x.equals(y));
Answers
Answered by
1
Answer:
i. Vision2020
ii. 6
iii. i
iv. false
Explanation:
i. It will concatenate both the string, as you using + sign.
ii. length function will return the length of the string with an integer value.
iii. charAt will return the char at the specific index. Here you pass 3 , so it will be 4th position, as index start from 0.
iv. equals function will compare both the string, and as it's different, else it will return Boolean false .
Answered by
0
Answer:
i. Vision2020
ii. 6
iii. i
iv. false
Similar questions