✏️ Explanatory Question

Which of the following will compile correctly?

  1. boolean b=-1;
  2. boolean b2=false;
  3. int i=019;
  4. char c=99;
👁 0 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

✔ Correct:

  • boolean b2=false;
  • char c=99;

❌ Incorrect:

  • boolean b=-1; → boolean only true/false
  • int i=019; → invalid octal (9 not allowed in base 8)