Skip to main content
CS Teaching Tips

Main navigation

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

Misconception: Students who first learn object-oriented programming in Python don’t realize they need to explicitly define instance variables in Java because this is done implicitly in Python.

Share Misconception: Students who first learn object-oriented programming in Python don’t realize they need to explicitly define instance variables in Java because this is done implicitly in Python. with FacebookShare Misconception: Students who first learn object-oriented programming in Python don’t realize they need to explicitly define instance variables in Java because this is done implicitly in Python. with Twitter
  • For example, in the Python code below, numSides is a data attribute (the Python equivalent of an instance variable).
    • numSides does not require it’s own declaration, thus its use in self.numSides is sufficient for it’s existence.

      class Die:

        def setSides(self, sides):
          self.numSides = sides

More about this tip

Tags

  • Content Misconceptions
  • Python
  • Java
  • Programming Concepts
External Source

Interview with Dave Musicant.

Other Tips By
Other Tips By Dave Musicant

Similar tips

Misconceptions: Loops can be difficult for students in Scratch Jr.
Step through an accumulator pattern on board to make clear how variables change within a while loop to help students understand this confusing topic.
Have students design a Java program that detects plagiarism within a set of documents so that they gain practice designing and applying data structures in a relevant context.

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

Privacy Policy