March 2019
Intermediate to advanced
242 pages
6h 21m
English
One of our programmers, Aarav, refactored some code by his team member, Pavni. The code no longer provides char and the corresponding ASCII numbers of the values stored by the char array. Can you help Aarav? The following is the code to use:
class Foo {
public static void main(String args[]) {
try {
char[] name = new char[]{'S','t','r','i','n','g'};
for (var c : name) {
System.out.println(c + ":" + (c + 1 - 1));
}
}
catch (var e) {
//code
}
}
}
The answer to the code check: The var type can't be used to specify the types of exceptions in the catch handler, (var e).
Read now
Unlock full access