✏️ Explanatory Question

Which of the following will compile correctly?

  1. short myshort=99S;
  2. String name='Excellent tutorial Mr Green';
  3. char c=17c;
  4. int z=015;
👁 0 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

✔ Correct:

  • int z=015;

👉 Explanation:

  • 015 is an octal number (base 8) → valid

❌ Incorrect:

  • 99S → invalid suffix
  • String must use " " not ' '
  • 17c → invalid literal