Skip to main content
CS Teaching Tips

Main navigation

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

Remind students to match types on both sides of the equations because they often try to combine types when creating variables.

Share Remind students to match types on both sides of the equations because they often try to combine types when creating variables. with FacebookShare Remind students to match types on both sides of the equations because they often try to combine types when creating variables. with Twitter
  • Ints need to be equal to ints, and doubles to doubles.
    • A common error occurs when students try to set an int equal to a string.
      • For example, int num = "2.5";
    • This stems from not fully understanding that the type on the left of an equation has to equal the type on the right of the equation.

More about this tip

Tags

  • CS 1
  • Intro Programming
  • Programming Concepts
  • Content Misconceptions
External Source

Interview with Dani McAvoy

Other Tips By
Other Tips By Dani McAvoy

Similar tips

Misconception: If you consistently use the same variable names during class in lectures and examples, students may incorrectly assume objects in Java can only have those names.
When teaching null dereferences, show a call that dereferences a null pointer in a debugger to give students a snapshot of what is happening.
Tell students they have to believe that some things just work before they will understand why it works because they need exposure to a lot of material before some concepts make sense individually.
  • 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