You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
Syntax error on token "yield", AssignmentOperator expected after this token
public class X {
public static void main(String[] args) {
Object x = "Hello";
String j = switch (x) {
case String s : yield "String";
default : { System.out.println();
yield "Default";
}
}
}
}
The second one is not helpful and head scratch inducing.
(2) This program generates: C cannot be resolved or is not a field which is not quite the case even though the error is valid.
public class X {
enum E1 {
A;
}
enum E2 {
B;
}
public static final int C = 42;
public static void main(String[] args) {
}
void foo(E1 e1) {
switch (e1) {
case A :
case C :
}
System.out.println(C);
}
}
The text was updated successfully, but these errors were encountered:
This program generates two errors:
The second one is not helpful and head scratch inducing.
(2) This program generates:
C cannot be resolved or is not a field
which is not quite the case even though the error is valid.The text was updated successfully, but these errors were encountered: