Home of real teaching & learning
  • Full support for teachers
  • Focus on critical thinking
  • Engaging classroom activities
  • Integrated student eBook
  • Assessed tasks / qBank
  • Practice exam questions

The InThinking Guarantee: Our sites are written by expert practitioners and not by AI

See our AI policy

Disclaimer: InThinking subject sites are neither endorsed by nor connected with the International Baccalaureate Organisation.

Don't miss out, find out!

B2.2 Broken Code challenges - Java

B2.2.2: Arrays & Lists (Bounds & access)/* Topic B2.2.2: Arrays CHALLENGE: This loop tries to print every student's name. But it crashes with an "ArrayIndexOutOfBoundsException". Look closely at the loop condition. */ public class Main { public static void main(String[] args) { String[] students = {"Alice", "Bob", "Charlie", "Diana"}; // BUG IS HERE // Array length is 4. Indices are 0, 1, 2, 3. // Does this loop stop...

Help