Skip to main content
CS Teaching Tips

Main navigation

  • Browse All Tips
  • Tags
  • 3D
  • About
  • Rate Tips
  • Tip Sheets

Have students label a string’s index values to help them understand how to use Java’s substring method.

Share Have students label a string’s index values to help them understand how to use Java’s substring method. with FacebookShare Have students label a string’s index values to help them understand how to use Java’s substring method. with Twitter
  • It is easier for students to choose the correct starting and ending arguments for substring when they have visual reference for characters and indices of the string.
  • The following is an example table containing string character values and index values.
String Values h e l l o
Index Values 0 1 2 3 4

More about this tip

Tags

  • AP A
  • Java
External Source

Leigh Ann Sudol-DeLyser’s notes from 2009 AP CS A exam.

Other Tips By
Other Tips By Leigh Ann Sudol-DeLyser

Similar tips

Have students create a game of Tetris in Java to work on object-oriented programming and decomposing complex programs.
In AP CS courses, encourage students to pay attention to examples provided in problem statements, as these often illustrate special cases and can help elucidate the correct approach.
Have students compete calculating to the 50th Fibonacci number, one team of humans doing the math versus a team students writing a program to stress the importance of computing for calculations.
  • CSTT Facebook
  • CSTT Twitter

For more information or to report a bug, contact us at admin@csteachingtips.org. Built with Bootstrap. Footer Icons by Mohammed Alyousfi. Powered by Drupal.

Privacy Policy

  • National Science Foundation
  • Sage Fox Group
  • Harvey Mudd College