let x = 5;
const y = 10;
var z = "hello";
int x = 5;
final int y = 10;
String z = "hello";
let value = 10;
value = "ten";
int value = 10;
value = "ten"; // 編譯錯誤
if (true) {
let x = 1;
}
// console.log(x); // 錯誤:x 不存在
if (true) {
int x = 1;
}
// System.out.println(x); // 錯誤:x 不存在
let notSet;
console.log(notSet); // undefined
int notSet;
// System.out.println(notSet); // 編譯錯誤