<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<blockquote type="cite"
cite="mid:CAGKkBksTAEjJahPjOkonAzX1mx=arMJUthj9FK-7ER0GB868fg@mail.gmail.com">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div><br>
</div>
<div>Can a single-statement case have a variable declaration
as that statement, and what would be its scope?</div>
</div>
</div>
</div>
</blockquote>
<br>
No, a local variable declaration is a BlockStatement (JLS 14.2), not
a Statement (JLS 14.5). So you could say:<br>
<br>
   case FOO -> println(3);<br>
<br>
or<br>
<br>
   case FOO -> {<br>
       int x = 4;<br>
       println(x);<br>
   }<br>
<br>
Of course, you don't have to ask about the scope of x. <br>
<br>
<br>
</body>
</html>