Turtles in Java - Turtles in Java Defining Turtles - write...

This preview shows page 1 - 2 out of 2 pages.

The preview shows page 1 - 2 out of 2 pages.
Turtles in JavaDefining Turtles-write a Turtle class definitionostore as Turtle.java-compile into something computer understandsobyte code can be executed on a virtual machineCreating objects-object that defines it must create it-need a unique way to refer to itodeclaring a variable-keyword: new ClassName-initialize the object to actually use itoall of the variables that define the state of the object (shape, color, etc)-syntax for new object: new Class (value, value, …);-must have a name for new object in order to refer to itogives us a way to work with the names and find it againDeclaring variables-give it a nameoshould be unique to the variable-declaration just gives name and type but doesn’t create object-computer assigns memory to the variable you declareoamount of memory depends on type of variableocomputer stores a map of the name to the memory location and typeLimits of Declaring variables-can’t declare two variables of the same nameo

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
Sibert
Tags
New Class, object variable refers, Turtle class definition, Java Defining Turtles

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture