[{"data":1,"prerenderedAt":3510},["ShallowReactive",2],{"item-lessons-light-ch08-constructors-and-this":3,"item-examples-light-ch08-constructors-and-this":444,"item-exercises-light-ch08-constructors-and-this":753,"item-lesson-full-ch08-constructors-and-this-8.1-8.2":1070,"item-example-full-ch08-constructors-and-this-8.1-8.2":1659,"item-exercise-full-ch08-constructors-and-this-8.1-8.2":2344},[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276,280,284,288,292,296,300,304,308,312,316,320,324,328,332,336,340,344,348,352,356,360,364,368,372,376,380,384,388,392,396,400,404,408,412,416,420,424,428,432,436,440],{"path":5,"title":6,"stem":7},"\u002Fshockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1-why-java-for-frc","Why Java for FRC?","shockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1.1-why-java-for-frc",{"path":9,"title":10,"stem":11},"\u002Fshockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers","shockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":13,"title":14,"stem":15},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":17,"title":18,"stem":19},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":21,"title":22,"stem":23},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":25,"title":26,"stem":27},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":29,"title":30,"stem":31},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":33,"title":34,"stem":35},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":37,"title":38,"stem":39},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":41,"title":42,"stem":43},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":45,"title":46,"stem":47},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":49,"title":50,"stem":51},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":53,"title":54,"stem":55},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":57,"title":58,"stem":59},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":61,"title":62,"stem":63},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":65,"title":66,"stem":67},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":69,"title":70,"stem":71},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","Control Structures: if Statements & For Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":73,"title":74,"stem":75},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":77,"title":78,"stem":79},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":81,"title":82,"stem":83},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":85,"title":86,"stem":87},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":89,"title":90,"stem":91},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":93,"title":94,"stem":95},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":97,"title":98,"stem":99},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":101,"title":102,"stem":103},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws)","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":105,"title":106,"stem":107},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F8-while-loops","While Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.8-while-loops",{"path":109,"title":110,"stem":111},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":113,"title":114,"stem":115},"\u002Fshockwave-curriculum\u002Flessons\u002Fch06-strings\u002F1-strings","Strings","shockwave-curriculum\u002Flessons\u002Fch06-strings\u002F6.1-strings",{"path":117,"title":118,"stem":119},"\u002Fshockwave-curriculum\u002Flessons\u002Fch06-strings\u002F2-string-algorithms","String Algorithms","shockwave-curriculum\u002Flessons\u002Fch06-strings\u002F6.2-string-algorithms",{"path":121,"title":122,"stem":123},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","The Class Blueprint","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":125,"title":126,"stem":127},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":129,"title":130,"stem":131},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":133,"title":134,"stem":135},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":137,"title":138,"stem":139},"\u002Fshockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\"","shockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":141,"title":142,"stem":143},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":145,"title":146,"stem":147},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":149,"title":150,"stem":151},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":153,"title":154,"stem":155},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":157,"title":158,"stem":159},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":161,"title":162,"stem":163},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":165,"title":166,"stem":167},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":169,"title":170,"stem":171},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":173,"title":174,"stem":175},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":177,"title":178,"stem":179},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":181,"title":182,"stem":183},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":185,"title":186,"stem":187},"\u002Fshockwave-curriculum\u002Flessons\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices","shockwave-curriculum\u002Flessons\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":189,"title":190,"stem":191},"\u002Fshockwave-curriculum\u002Flessons\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch","shockwave-curriculum\u002Flessons\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":193,"title":194,"stem":195},"\u002Fshockwave-curriculum\u002Flessons\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas","shockwave-curriculum\u002Flessons\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":197,"title":198,"stem":199},"\u002Fshockwave-curriculum\u002Flessons\u002Fch14-why-design-patterns\u002F14-why-design-patterns","Why Design Patterns?","shockwave-curriculum\u002Flessons\u002Fch14-why-design-patterns\u002F14-why-design-patterns",{"path":201,"title":202,"stem":203},"\u002Fshockwave-curriculum\u002Flessons\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap)","shockwave-curriculum\u002Flessons\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":205,"title":206,"stem":207},"\u002Fshockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics","shockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":209,"title":210,"stem":211},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":213,"title":214,"stem":215},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":217,"title":218,"stem":219},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":221,"title":222,"stem":223},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":225,"title":226,"stem":227},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":229,"title":230,"stem":231},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":233,"title":234,"stem":235},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":237,"title":238,"stem":239},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":241,"title":242,"stem":243},"\u002Fshockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts","shockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":245,"title":246,"stem":247},"\u002Fshockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References","shockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":249,"title":250,"stem":251},"\u002Fshockwave-curriculum\u002Flessons\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern","shockwave-curriculum\u002Flessons\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":253,"title":254,"stem":255},"\u002Fshockwave-curriculum\u002Flessons\u002Fch21-static-factories\u002F21-static-factories","Static Factories","shockwave-curriculum\u002Flessons\u002Fch21-static-factories\u002F21-static-factories",{"path":257,"title":258,"stem":259},"\u002Fshockwave-curriculum\u002Flessons\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern","shockwave-curriculum\u002Flessons\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":261,"title":262,"stem":263},"\u002Fshockwave-curriculum\u002Flessons\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability","shockwave-curriculum\u002Flessons\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":265,"title":266,"stem":267},"\u002Fshockwave-curriculum\u002Flessons\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions","shockwave-curriculum\u002Flessons\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":269,"title":270,"stem":271},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming?","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":273,"title":274,"stem":275},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":277,"title":278,"stem":279},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":281,"title":282,"stem":283},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":285,"title":286,"stem":287},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":289,"title":290,"stem":291},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":293,"title":294,"stem":295},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":297,"title":298,"stem":299},"\u002Fshockwave-curriculum\u002Flessons\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways","shockwave-curriculum\u002Flessons\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":301,"title":302,"stem":303},"\u002Fshockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design","shockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":305,"title":306,"stem":307},"\u002Fshockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F2-impact-of-program-design","Impact of Program Design","shockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F27.2-impact-of-program-design",{"path":309,"title":310,"stem":311},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":313,"title":314,"stem":315},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":317,"title":318,"stem":319},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":321,"title":322,"stem":323},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",{"path":325,"title":326,"stem":327},"\u002Fshockwave-curriculum\u002Flessons\u002Fch29-git-and-github-basics\u002F1-coming-soon","Git & GitHub Basics — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch29-git-and-github-basics\u002F29.1-coming-soon",{"path":329,"title":330,"stem":331},"\u002Fshockwave-curriculum\u002Flessons\u002Fch30-git-history-and-merging\u002F1-coming-soon","Git — History & Merging — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch30-git-history-and-merging\u002F30.1-coming-soon",{"path":333,"title":334,"stem":335},"\u002Fshockwave-curriculum\u002Flessons\u002Fch31-dev-environment-and-tooling\u002F1-coming-soon","Dev Environment & Tooling — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch31-dev-environment-and-tooling\u002F31.1-coming-soon",{"path":337,"title":338,"stem":339},"\u002Fshockwave-curriculum\u002Flessons\u002Fch32-unit-testing\u002F1-coming-soon","Unit Testing — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch32-unit-testing\u002F32.1-coming-soon",{"path":341,"title":342,"stem":343},"\u002Fshockwave-curriculum\u002Flessons\u002Fch33-advantagekit-autologging\u002F1-coming-soon","AdvantageKit — AutoLogging — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch33-advantagekit-autologging\u002F33.1-coming-soon",{"path":345,"title":346,"stem":347},"\u002Fshockwave-curriculum\u002Flessons\u002Fch34-log-replay\u002F1-coming-soon","Log Replay — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch34-log-replay\u002F34.1-coming-soon",{"path":349,"title":350,"stem":351},"\u002Fshockwave-curriculum\u002Flessons\u002Fch35-advantagescope-i-visualization\u002F1-coming-soon","AdvantageScope I: Visualization — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch35-advantagescope-i-visualization\u002F35.1-coming-soon",{"path":353,"title":354,"stem":355},"\u002Fshockwave-curriculum\u002Flessons\u002Fch36-advantagescope-ii-custom-3d-assets\u002F1-coming-soon","AdvantageScope II: Custom 3D Assets — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch36-advantagescope-ii-custom-3d-assets\u002F36.1-coming-soon",{"path":357,"title":358,"stem":359},"\u002Fshockwave-curriculum\u002Flessons\u002Fch37-autonomous-i\u002F1-coming-soon","Autonomous I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch37-autonomous-i\u002F37.1-coming-soon",{"path":361,"title":362,"stem":363},"\u002Fshockwave-curriculum\u002Flessons\u002Fch38-autonomous-ii-pathplanner-and-trajectories\u002F1-coming-soon","Autonomous II: PathPlanner & Trajectories — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch38-autonomous-ii-pathplanner-and-trajectories\u002F38.1-coming-soon",{"path":365,"title":366,"stem":367},"\u002Fshockwave-curriculum\u002Flessons\u002Fch39-control-fundamentals\u002F1-coming-soon","Control Fundamentals — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch39-control-fundamentals\u002F39.1-coming-soon",{"path":369,"title":370,"stem":371},"\u002Fshockwave-curriculum\u002Flessons\u002Fch40-motion-profiles\u002F1-coming-soon","Motion Profiles — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch40-motion-profiles\u002F40.1-coming-soon",{"path":373,"title":374,"stem":375},"\u002Fshockwave-curriculum\u002Flessons\u002Fch41-hardware-fundamentals\u002F1-coming-soon","Hardware Fundamentals — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch41-hardware-fundamentals\u002F41.1-coming-soon",{"path":377,"title":378,"stem":379},"\u002Fshockwave-curriculum\u002Flessons\u002Fch42-photonvision\u002F1-coming-soon","PhotonVision — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch42-photonvision\u002F42.1-coming-soon",{"path":381,"title":382,"stem":383},"\u002Fshockwave-curriculum\u002Flessons\u002Fch43-apriltags-and-pose\u002F1-coming-soon","AprilTags & Pose — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch43-apriltags-and-pose\u002F43.1-coming-soon",{"path":385,"title":386,"stem":387},"\u002Fshockwave-curriculum\u002Flessons\u002Fch44-subsystems-i\u002F1-coming-soon","Subsystems I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch44-subsystems-i\u002F44.1-coming-soon",{"path":389,"title":390,"stem":391},"\u002Fshockwave-curriculum\u002Flessons\u002Fch45-subsystems-ii-advanced\u002F1-coming-soon","Subsystems II — Advanced — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch45-subsystems-ii-advanced\u002F45.1-coming-soon",{"path":393,"title":394,"stem":395},"\u002Fshockwave-curriculum\u002Flessons\u002Fch46-team-utilities-i\u002F1-coming-soon","Team Utilities I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch46-team-utilities-i\u002F46.1-coming-soon",{"path":397,"title":398,"stem":399},"\u002Fshockwave-curriculum\u002Flessons\u002Fch47-field-constants\u002F1-coming-soon","Field Constants — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch47-field-constants\u002F47.1-coming-soon",{"path":401,"title":402,"stem":403},"\u002Fshockwave-curriculum\u002Flessons\u002Fch48-troubleshooting-i-runtime-debug\u002F1-coming-soon","Troubleshooting I — Runtime Debug — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch48-troubleshooting-i-runtime-debug\u002F48.1-coming-soon",{"path":405,"title":406,"stem":407},"\u002Fshockwave-curriculum\u002Flessons\u002Fch49-troubleshooting-ii-can-and-sim\u002F1-coming-soon","Troubleshooting II: CAN & Sim — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch49-troubleshooting-ii-can-and-sim\u002F49.1-coming-soon",{"path":409,"title":410,"stem":411},"\u002Fshockwave-curriculum\u002Flessons\u002Fch50-vendor-libraries-talonfx\u002F1-coming-soon","Vendor Libraries: TalonFX — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch50-vendor-libraries-talonfx\u002F50.1-coming-soon",{"path":413,"title":414,"stem":415},"\u002Fshockwave-curriculum\u002Flessons\u002Fch51-robot-alerts\u002F1-coming-soon","Robot Alerts — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch51-robot-alerts\u002F51.1-coming-soon",{"path":417,"title":418,"stem":419},"\u002Fshockwave-curriculum\u002Flessons\u002Fch52-wpilib-commands\u002F1-coming-soon","WPILib Commands — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch52-wpilib-commands\u002F52.1-coming-soon",{"path":421,"title":422,"stem":423},"\u002Fshockwave-curriculum\u002Flessons\u002Fch53-wpilib-geometry\u002F1-coming-soon","WPILib Geometry — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch53-wpilib-geometry\u002F53.1-coming-soon",{"path":425,"title":426,"stem":427},"\u002Fshockwave-curriculum\u002Flessons\u002Fch54-networktables\u002F1-coming-soon","NetworkTables — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch54-networktables\u002F54.1-coming-soon",{"path":429,"title":430,"stem":431},"\u002Fshockwave-curriculum\u002Flessons\u002Fch55-command-scheduler\u002F1-coming-soon","Command Scheduler — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch55-command-scheduler\u002F55.1-coming-soon",{"path":433,"title":434,"stem":435},"\u002Fshockwave-curriculum\u002Flessons\u002Fch56-wpilib-timers\u002F1-coming-soon","WPILib Timers — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch56-wpilib-timers\u002F56.1-coming-soon",{"path":437,"title":438,"stem":439},"\u002Fshockwave-curriculum\u002Flessons\u002Fch57-wpilib-triggers\u002F1-coming-soon","WPILib Triggers — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch57-wpilib-triggers\u002F57.1-coming-soon",{"path":441,"title":442,"stem":443},"\u002Fshockwave-curriculum\u002Flessons\u002Fch58-vendor-units-and-conversions\u002F1-coming-soon","Vendor Units & Conversions — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch58-vendor-units-and-conversions\u002F58.1-coming-soon",[445,449,453,457,461,465,469,473,477,481,485,489,493,497,501,505,509,513,517,521,525,529,533,537,541,545,549,553,557,561,565,569,573,577,581,585,589,593,597,601,605,609,613,617,621,625,629,633,637,641,645,649,653,657,661,665,669,673,677,681,685,689,693,697,701,705,709,713,717,721,725,729,733,737,741,745,749],{"path":446,"title":447,"stem":448},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":450,"title":451,"stem":452},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":454,"title":455,"stem":456},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":458,"title":459,"stem":460},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":462,"title":463,"stem":464},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":466,"title":467,"stem":468},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":470,"title":471,"stem":472},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":474,"title":475,"stem":476},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":478,"title":479,"stem":480},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":482,"title":483,"stem":484},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":486,"title":487,"stem":488},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":490,"title":491,"stem":492},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":494,"title":495,"stem":496},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":498,"title":499,"stem":500},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":502,"title":503,"stem":504},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":506,"title":507,"stem":508},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","if Statements & For Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":510,"title":511,"stem":512},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":514,"title":515,"stem":516},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":518,"title":519,"stem":520},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":522,"title":523,"stem":524},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":526,"title":527,"stem":528},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":530,"title":531,"stem":532},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":534,"title":535,"stem":536},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":538,"title":539,"stem":540},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws) — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":542,"title":543,"stem":544},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F8-while-loops","While Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.8-while-loops",{"path":546,"title":547,"stem":548},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":550,"title":551,"stem":552},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F1-strings","Strings — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F6.1-strings",{"path":554,"title":555,"stem":556},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F2-string-algorithms","String Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F6.2-string-algorithms",{"path":558,"title":559,"stem":560},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","Anatomy of a Java Class — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":562,"title":563,"stem":564},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":566,"title":567,"stem":568},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":570,"title":571,"stem":572},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":574,"title":575,"stem":576},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\" — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":578,"title":579,"stem":580},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":582,"title":583,"stem":584},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":586,"title":587,"stem":588},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":590,"title":591,"stem":592},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":594,"title":595,"stem":596},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":598,"title":599,"stem":600},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":602,"title":603,"stem":604},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":606,"title":607,"stem":608},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":610,"title":611,"stem":612},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":614,"title":615,"stem":616},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":618,"title":619,"stem":620},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":622,"title":623,"stem":624},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":626,"title":627,"stem":628},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":630,"title":631,"stem":632},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":634,"title":635,"stem":636},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap) — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":638,"title":639,"stem":640},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":642,"title":643,"stem":644},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":646,"title":647,"stem":648},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":650,"title":651,"stem":652},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":654,"title":655,"stem":656},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":658,"title":659,"stem":660},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":662,"title":663,"stem":664},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":666,"title":667,"stem":668},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":670,"title":671,"stem":672},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":674,"title":675,"stem":676},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":678,"title":679,"stem":680},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":682,"title":683,"stem":684},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":686,"title":687,"stem":688},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch21-static-factories\u002F21-static-factories","Static Factories — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch21-static-factories\u002F21-static-factories",{"path":690,"title":691,"stem":692},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":694,"title":695,"stem":696},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":698,"title":699,"stem":700},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":702,"title":703,"stem":704},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming? — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":706,"title":707,"stem":708},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":710,"title":711,"stem":712},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":714,"title":715,"stem":716},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":718,"title":719,"stem":720},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":722,"title":723,"stem":724},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":726,"title":727,"stem":728},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":730,"title":731,"stem":732},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":734,"title":735,"stem":736},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":738,"title":739,"stem":740},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":742,"title":743,"stem":744},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":746,"title":747,"stem":748},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":750,"title":751,"stem":752},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",[754,758,762,766,770,774,778,782,786,790,794,798,802,806,810,814,818,822,826,830,834,838,842,846,850,854,858,862,866,870,874,878,882,886,890,894,898,902,906,910,914,918,922,926,930,934,938,942,946,950,954,958,962,966,970,974,978,982,986,990,994,998,1002,1006,1010,1014,1018,1022,1026,1030,1034,1038,1042,1046,1050,1054,1058,1062,1066],{"path":755,"title":756,"stem":757},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers — Exercises","shockwave-curriculum\u002Fexercises\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":759,"title":760,"stem":761},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":763,"title":764,"stem":765},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":767,"title":768,"stem":769},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":771,"title":772,"stem":773},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":775,"title":776,"stem":777},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":779,"title":780,"stem":781},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":783,"title":784,"stem":785},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":787,"title":788,"stem":789},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":791,"title":792,"stem":793},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":795,"title":796,"stem":797},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":799,"title":800,"stem":801},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":803,"title":804,"stem":805},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":807,"title":808,"stem":809},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":811,"title":812,"stem":813},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":815,"title":816,"stem":817},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","if Statements & For Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":819,"title":820,"stem":821},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":823,"title":824,"stem":825},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":827,"title":828,"stem":829},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":831,"title":832,"stem":833},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":835,"title":836,"stem":837},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":839,"title":840,"stem":841},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":843,"title":844,"stem":845},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":847,"title":848,"stem":849},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws) — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":851,"title":852,"stem":853},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F8-while-loops","While Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.8-while-loops",{"path":855,"title":856,"stem":857},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":859,"title":860,"stem":861},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F1-strings","Strings — Exercises","shockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F6.1-strings",{"path":863,"title":864,"stem":865},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F2-string-algorithms","String Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F6.2-string-algorithms",{"path":867,"title":868,"stem":869},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","Anatomy of a Java Class — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":871,"title":872,"stem":873},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":875,"title":876,"stem":877},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":879,"title":880,"stem":881},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":883,"title":884,"stem":885},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\" — Exercises","shockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":887,"title":888,"stem":889},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":891,"title":892,"stem":893},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":895,"title":896,"stem":897},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":899,"title":900,"stem":901},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":903,"title":904,"stem":905},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":907,"title":908,"stem":909},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":911,"title":912,"stem":913},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":915,"title":916,"stem":917},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":919,"title":920,"stem":921},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":923,"title":924,"stem":925},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":927,"title":928,"stem":929},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":931,"title":932,"stem":933},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices — Exercises","shockwave-curriculum\u002Fexercises\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":935,"title":936,"stem":937},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch — Exercises","shockwave-curriculum\u002Fexercises\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":939,"title":940,"stem":941},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas — Exercises","shockwave-curriculum\u002Fexercises\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":943,"title":944,"stem":945},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch14-why-design-patterns\u002F14-why-design-patterns","Why Design Patterns? — Exercises","shockwave-curriculum\u002Fexercises\u002Fch14-why-design-patterns\u002F14-why-design-patterns",{"path":947,"title":948,"stem":949},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap) — Exercises","shockwave-curriculum\u002Fexercises\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":951,"title":952,"stem":953},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics — Exercises","shockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":955,"title":956,"stem":957},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":959,"title":960,"stem":961},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":963,"title":964,"stem":965},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":967,"title":968,"stem":969},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":971,"title":972,"stem":973},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":975,"title":976,"stem":977},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":979,"title":980,"stem":981},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":983,"title":984,"stem":985},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":987,"title":988,"stem":989},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts — Exercises","shockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":991,"title":992,"stem":993},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References — Exercises","shockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":995,"title":996,"stem":997},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern — Exercises","shockwave-curriculum\u002Fexercises\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":999,"title":1000,"stem":1001},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch21-static-factories\u002F21-static-factories","Static Factories — Exercises","shockwave-curriculum\u002Fexercises\u002Fch21-static-factories\u002F21-static-factories",{"path":1003,"title":1004,"stem":1005},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern — Exercises","shockwave-curriculum\u002Fexercises\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":1007,"title":1008,"stem":1009},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability — Exercises","shockwave-curriculum\u002Fexercises\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":1011,"title":1012,"stem":1013},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":1015,"title":1016,"stem":1017},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming? — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":1019,"title":1020,"stem":1021},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":1023,"title":1024,"stem":1025},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":1027,"title":1028,"stem":1029},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":1031,"title":1032,"stem":1033},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":1035,"title":1036,"stem":1037},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":1039,"title":1040,"stem":1041},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":1043,"title":1044,"stem":1045},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways — Exercises","shockwave-curriculum\u002Fexercises\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":1047,"title":1048,"stem":1049},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design — Exercises","shockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":1051,"title":1052,"stem":1053},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F2-impact-of-program-design","Impact of Program Design — Exercises","shockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F27.2-impact-of-program-design",{"path":1055,"title":1056,"stem":1057},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":1059,"title":1060,"stem":1061},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":1063,"title":1064,"stem":1065},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":1067,"title":1068,"stem":1069},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",{"id":1071,"title":138,"body":1072,"description":1104,"extension":1653,"meta":1654,"navigation":1132,"path":137,"seo":1657,"stem":139,"__hash__":1658},"lessons\u002Fshockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this.md",{"type":1073,"value":1074,"toc":1640},"minimark",[1075,1079,1084,1098,1164,1168,1195,1217,1221,1228,1314,1321,1335,1405,1422,1429,1446,1469,1478,1490,1496,1501,1545,1549,1595,1599,1626,1636],[1076,1077,138],"h1",{"id":1078},"constructors-this",[1080,1081,1083],"h2",{"id":1082},"a-constructors-job","A Constructor's Job",[1085,1086,1087,1088,1092,1093,1097],"p",{},"A constructor's only job is to put a new object into a ",[1089,1090,1091],"strong",{},"valid state"," — every instance variable set to something usable. Its signature looks like a method's, but with two differences: no return type (not even ",[1094,1095,1096],"code",{},"void","), and its name is always exactly the class's name.",[1099,1100,1105],"pre",{"className":1101,"code":1102,"language":1103,"meta":1104,"style":1104},"language-java shiki shiki-themes github-light github-dark","public class Climber\n{\n    private int motorPort;\n\n    public Climber(int motorPort) \u002F\u002F same name as the class, no return type\n    {\n        this.motorPort = motorPort;\n    }\n}\n","java","",[1094,1106,1107,1115,1121,1127,1134,1140,1146,1152,1158],{"__ignoreMap":1104},[1108,1109,1112],"span",{"class":1110,"line":1111},"line",1,[1108,1113,1114],{},"public class Climber\n",[1108,1116,1118],{"class":1110,"line":1117},2,[1108,1119,1120],{},"{\n",[1108,1122,1124],{"class":1110,"line":1123},3,[1108,1125,1126],{},"    private int motorPort;\n",[1108,1128,1130],{"class":1110,"line":1129},4,[1108,1131,1133],{"emptyLinePlaceholder":1132},true,"\n",[1108,1135,1137],{"class":1110,"line":1136},5,[1108,1138,1139],{},"    public Climber(int motorPort) \u002F\u002F same name as the class, no return type\n",[1108,1141,1143],{"class":1110,"line":1142},6,[1108,1144,1145],{},"    {\n",[1108,1147,1149],{"class":1110,"line":1148},7,[1108,1150,1151],{},"        this.motorPort = motorPort;\n",[1108,1153,1155],{"class":1110,"line":1154},8,[1108,1156,1157],{},"    }\n",[1108,1159,1161],{"class":1110,"line":1160},9,[1108,1162,1163],{},"}\n",[1080,1165,1167],{"id":1166},"the-default-constructor","The Default Constructor",[1085,1169,1170,1171,1174,1175,1178,1179,1174,1182,1178,1185,1174,1188,1178,1191,1194],{},"Every instance variable starts at its type's default the instant an object exists — ",[1094,1172,1173],{},"0"," for ",[1094,1176,1177],{},"int",", ",[1094,1180,1181],{},"0.0",[1094,1183,1184],{},"double",[1094,1186,1187],{},"false",[1094,1189,1190],{},"boolean",[1094,1192,1193],{},"null"," for any reference type — whether or not you ever write a constructor. If you don't write any constructor at all, Java adds an empty no-argument one for you; it doesn't do anything beyond that automatic default-initialization. The moment you write even one constructor yourself, that free one disappears — you have to cover every way you want objects of your class to be built.",[1099,1196,1198],{"className":1101,"code":1197,"language":1103,"meta":1104,"style":1104},"public class Climber\n{\n    private int motorPort; \u002F\u002F if no constructor is written, this defaults to 0\n}\n",[1094,1199,1200,1204,1208,1213],{"__ignoreMap":1104},[1108,1201,1202],{"class":1110,"line":1111},[1108,1203,1114],{},[1108,1205,1206],{"class":1110,"line":1117},[1108,1207,1120],{},[1108,1209,1210],{"class":1110,"line":1123},[1108,1211,1212],{},"    private int motorPort; \u002F\u002F if no constructor is written, this defaults to 0\n",[1108,1214,1215],{"class":1110,"line":1129},[1108,1216,1163],{},[1080,1218,1220],{"id":1219},"overloaded-constructors","Overloaded Constructors",[1085,1222,1223,1224,1227],{},"Just like methods (Ch.4.1), a class can have several constructors, distinguished by their parameter lists — this is the same ",[1089,1225,1226],{},"overloading"," concept:",[1099,1229,1231],{"className":1101,"code":1230,"language":1103,"meta":1104,"style":1104},"public class Climber\n{\n    private int motorPort;\n    private double climbSpeed;\n\n    public Climber(int motorPort)\n    {\n        this.motorPort = motorPort;\n        this.climbSpeed = 0.5; \u002F\u002F a sensible default\n    }\n\n    public Climber(int motorPort, double climbSpeed)\n    {\n        this.motorPort = motorPort;\n        this.climbSpeed = climbSpeed;\n    }\n}\n",[1094,1232,1233,1237,1241,1245,1250,1254,1259,1263,1267,1272,1277,1282,1288,1293,1298,1304,1309],{"__ignoreMap":1104},[1108,1234,1235],{"class":1110,"line":1111},[1108,1236,1114],{},[1108,1238,1239],{"class":1110,"line":1117},[1108,1240,1120],{},[1108,1242,1243],{"class":1110,"line":1123},[1108,1244,1126],{},[1108,1246,1247],{"class":1110,"line":1129},[1108,1248,1249],{},"    private double climbSpeed;\n",[1108,1251,1252],{"class":1110,"line":1136},[1108,1253,1133],{"emptyLinePlaceholder":1132},[1108,1255,1256],{"class":1110,"line":1142},[1108,1257,1258],{},"    public Climber(int motorPort)\n",[1108,1260,1261],{"class":1110,"line":1148},[1108,1262,1145],{},[1108,1264,1265],{"class":1110,"line":1154},[1108,1266,1151],{},[1108,1268,1269],{"class":1110,"line":1160},[1108,1270,1271],{},"        this.climbSpeed = 0.5; \u002F\u002F a sensible default\n",[1108,1273,1275],{"class":1110,"line":1274},10,[1108,1276,1157],{},[1108,1278,1280],{"class":1110,"line":1279},11,[1108,1281,1133],{"emptyLinePlaceholder":1132},[1108,1283,1285],{"class":1110,"line":1284},12,[1108,1286,1287],{},"    public Climber(int motorPort, double climbSpeed)\n",[1108,1289,1291],{"class":1110,"line":1290},13,[1108,1292,1145],{},[1108,1294,1296],{"class":1110,"line":1295},14,[1108,1297,1151],{},[1108,1299,1301],{"class":1110,"line":1300},15,[1108,1302,1303],{},"        this.climbSpeed = climbSpeed;\n",[1108,1305,1307],{"class":1110,"line":1306},16,[1108,1308,1157],{},[1108,1310,1312],{"class":1110,"line":1311},17,[1108,1313,1163],{},[1080,1315,1317,1318],{"id":1316},"chaining-constructors-with-this","Chaining Constructors with ",[1094,1319,1320],{},"this(...)",[1085,1322,1323,1324,1327,1328,1331,1332,1334],{},"The two ",[1094,1325,1326],{},"Climber"," constructors above duplicate the ",[1094,1329,1330],{},"this.motorPort = motorPort;"," line. When one constructor's job is really \"do what another constructor does, plus a little more,\" it can call that other constructor directly with ",[1094,1333,1320],{}," instead of repeating its body:",[1099,1336,1338],{"className":1101,"code":1337,"language":1103,"meta":1104,"style":1104},"public class Climber\n{\n    private int motorPort;\n    private double climbSpeed;\n\n    public Climber(int motorPort)\n    {\n        this(motorPort, 0.5); \u002F\u002F delegates to the two-argument constructor below\n    }\n\n    public Climber(int motorPort, double climbSpeed)\n    {\n        this.motorPort = motorPort;\n        this.climbSpeed = climbSpeed;\n    }\n}\n",[1094,1339,1340,1344,1348,1352,1356,1360,1364,1368,1373,1377,1381,1385,1389,1393,1397,1401],{"__ignoreMap":1104},[1108,1341,1342],{"class":1110,"line":1111},[1108,1343,1114],{},[1108,1345,1346],{"class":1110,"line":1117},[1108,1347,1120],{},[1108,1349,1350],{"class":1110,"line":1123},[1108,1351,1126],{},[1108,1353,1354],{"class":1110,"line":1129},[1108,1355,1249],{},[1108,1357,1358],{"class":1110,"line":1136},[1108,1359,1133],{"emptyLinePlaceholder":1132},[1108,1361,1362],{"class":1110,"line":1142},[1108,1363,1258],{},[1108,1365,1366],{"class":1110,"line":1148},[1108,1367,1145],{},[1108,1369,1370],{"class":1110,"line":1154},[1108,1371,1372],{},"        this(motorPort, 0.5); \u002F\u002F delegates to the two-argument constructor below\n",[1108,1374,1375],{"class":1110,"line":1160},[1108,1376,1157],{},[1108,1378,1379],{"class":1110,"line":1274},[1108,1380,1133],{"emptyLinePlaceholder":1132},[1108,1382,1383],{"class":1110,"line":1279},[1108,1384,1287],{},[1108,1386,1387],{"class":1110,"line":1284},[1108,1388,1145],{},[1108,1390,1391],{"class":1110,"line":1290},[1108,1392,1151],{},[1108,1394,1395],{"class":1110,"line":1295},[1108,1396,1303],{},[1108,1398,1399],{"class":1110,"line":1300},[1108,1400,1157],{},[1108,1402,1403],{"class":1110,"line":1306},[1108,1404,1163],{},[1085,1406,1407,1408,1410,1411,1415,1416,1418,1419,1421],{},"On Java 17, a ",[1094,1409,1320],{}," call must be the very first statement in the constructor — nothing can come before it, not even a simple argument check. Java 25 (JEP 513, ",[1412,1413,1414],"em",{},"Flexible Constructor Bodies",") relaxes this: statements can now run before ",[1094,1417,1320],{},", as long as they don't touch the new object's fields or call its methods yet (validating an argument, for example, is fine). This lesson still puts ",[1094,1420,1320],{}," first, which works unchanged on both versions.",[1080,1423,1425,1428],{"id":1424},"this-referring-to-the-current-object",[1094,1426,1427],{},"this",": Referring to the Current Object",[1085,1430,1431,1432,1434,1435,1438,1439,1442,1443,1445],{},"Inside an instance method or constructor, ",[1094,1433,1427],{}," refers to the specific object the method\u002Fconstructor is currently running for. It's most useful when a parameter shares a name with an instance variable — ",[1094,1436,1437],{},"this.motorPort"," unambiguously means \"this object's ",[1094,1440,1441],{},"motorPort",",\" while bare ",[1094,1444,1441],{}," means the parameter:",[1099,1447,1449],{"className":1101,"code":1448,"language":1103,"meta":1104,"style":1104},"public Climber(int motorPort)\n{\n    this.motorPort = motorPort; \u002F\u002F left side: instance variable. right side: parameter.\n}\n",[1094,1450,1451,1456,1460,1465],{"__ignoreMap":1104},[1108,1452,1453],{"class":1110,"line":1111},[1108,1454,1455],{},"public Climber(int motorPort)\n",[1108,1457,1458],{"class":1110,"line":1117},[1108,1459,1120],{},[1108,1461,1462],{"class":1110,"line":1123},[1108,1463,1464],{},"    this.motorPort = motorPort; \u002F\u002F left side: instance variable. right side: parameter.\n",[1108,1466,1467],{"class":1110,"line":1129},[1108,1468,1163],{},[1085,1470,1471,1472,1178,1474,1477],{},"Without ",[1094,1473,1427],{},[1094,1475,1476],{},"motorPort = motorPort;"," would just assign the parameter to itself — the instance variable would never actually get set.",[1085,1479,1480,1482,1483,1486,1487,1489],{},[1094,1481,1427],{}," only exists inside instance methods and constructors — a ",[1094,1484,1485],{},"static"," method has no current object to refer to, so it has no ",[1094,1488,1427],{}," (Ch.7.4).",[1080,1491,1493,1495],{"id":1492},"this-as-an-argument",[1094,1494,1427],{}," as an Argument",[1085,1497,1498,1500],{},[1094,1499,1427],{}," is a real reference, usable anywhere an object reference is expected — including passing the current object into another method or constructor:",[1099,1502,1504],{"className":1101,"code":1503,"language":1103,"meta":1104,"style":1104},"public class Climber\n{\n    private double currentHeight;\n\n    public void reportTo(ClimbLogger logger)\n    {\n        logger.record(this); \u002F\u002F pass the current Climber object itself\n    }\n}\n",[1094,1505,1506,1510,1514,1519,1523,1528,1532,1537,1541],{"__ignoreMap":1104},[1108,1507,1508],{"class":1110,"line":1111},[1108,1509,1114],{},[1108,1511,1512],{"class":1110,"line":1117},[1108,1513,1120],{},[1108,1515,1516],{"class":1110,"line":1123},[1108,1517,1518],{},"    private double currentHeight;\n",[1108,1520,1521],{"class":1110,"line":1129},[1108,1522,1133],{"emptyLinePlaceholder":1132},[1108,1524,1525],{"class":1110,"line":1136},[1108,1526,1527],{},"    public void reportTo(ClimbLogger logger)\n",[1108,1529,1530],{"class":1110,"line":1142},[1108,1531,1145],{},[1108,1533,1534],{"class":1110,"line":1148},[1108,1535,1536],{},"        logger.record(this); \u002F\u002F pass the current Climber object itself\n",[1108,1538,1539],{"class":1110,"line":1154},[1108,1540,1157],{},[1108,1542,1543],{"class":1110,"line":1160},[1108,1544,1163],{},[1080,1546,1548],{"id":1547},"common-pitfalls","Common Pitfalls",[1550,1551,1552,1568,1578],"ul",{},[1553,1554,1555,1561,1562,1564,1565,1567],"li",{},[1089,1556,1557,1558,1560],{},"Forgetting ",[1094,1559,1427],{}," when a parameter shadows an instance variable"," — the general scope\u002Flifetime rule behind this is Ch.7.2's \"Where Variables Live.\" ",[1094,1563,1476],{}," (no ",[1094,1566,1427],{},") does nothing useful — it assigns the parameter to itself, leaving the actual instance variable untouched.",[1553,1569,1570,1573,1574,1577],{},[1089,1571,1572],{},"Assuming a class always gets a free default constructor."," Only true if you write ",[1412,1575,1576],{},"zero"," constructors yourself. Write even one, and you're responsible for every constructor your class needs.",[1553,1579,1580,1587,1588,1590,1591,1594],{},[1089,1581,1582,1583,1586],{},"Writing ",[1094,1584,1585],{},"void Climber(...)"," instead of a constructor."," Adding a return type — even ",[1094,1589,1096],{}," — makes it an ordinary method that just happens to share the class's name, not a constructor. It never runs automatically when you ",[1094,1592,1593],{},"new"," the class; Java still builds the object with whichever real constructor exists (or the free default one, if you wrote none).",[1080,1596,1598],{"id":1597},"key-takeaways","Key Takeaways",[1550,1600,1601,1604,1607,1613,1618],{},[1553,1602,1603],{},"A constructor's signature has no return type and always matches the class's name; its job is to leave the object in a valid state.",[1553,1605,1606],{},"Every instance variable starts at its type's default regardless of any constructor; with no constructor written, Java adds an empty default one — writing any constructor yourself removes it.",[1553,1608,1609,1610,1612],{},"Constructors can be overloaded, just like methods, distinguished by parameter lists; one overload can delegate to another with ",[1094,1611,1320],{}," instead of repeating setup code (first statement on Java 17; Java 25 also allows validation before it, JEP 513).",[1553,1614,1615,1617],{},[1094,1616,1427],{}," refers to the current object inside an instance method or constructor — essential for disambiguating a parameter from an instance variable of the same name (shadowing, Ch.7.2).",[1553,1619,1620,1622,1623,1625],{},[1094,1621,1427],{}," can be passed as an argument, like any other object reference. Static methods have no ",[1094,1624,1427],{},".",[1085,1627,1628,1631,1632,1635],{},[1089,1629,1630],{},"Deck context:"," ",[1094,1633,1634],{},"mechacoder-test\u002Fsrc\u002Flessons\u002Fjava-1.js",", slide 8 (\"CONSTRUCTORS\")",[1637,1638,1639],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":1104,"searchDepth":1117,"depth":1117,"links":1641},[1642,1643,1644,1645,1647,1649,1651,1652],{"id":1082,"depth":1117,"text":1083},{"id":1166,"depth":1117,"text":1167},{"id":1219,"depth":1117,"text":1220},{"id":1316,"depth":1117,"text":1646},"Chaining Constructors with this(...)",{"id":1424,"depth":1117,"text":1648},"this: Referring to the Current Object",{"id":1492,"depth":1117,"text":1650},"this as an Argument",{"id":1547,"depth":1117,"text":1548},{"id":1597,"depth":1117,"text":1598},"md",{"outlineRef":1655,"status":1656},"8.1 (Writing Constructors, CSA 3.4) + 8.2 (this Keyword, CSA 3.9) — combined","new — authored lesson (fuller depth than the teaser slide). This single lesson covers both items together, matching the existing deck slide's combined granularity.",{"title":138,"description":1104},"kptM8evpl6ma8R5WHgpaYj2WZEqh0WrM_u5lnK7nMwc",{"id":1660,"title":575,"body":1661,"description":1104,"extension":1653,"meta":2339,"navigation":1132,"path":574,"seo":2342,"stem":576,"__hash__":2343},"examples\u002Fshockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this.md",{"type":1073,"value":1662,"toc":2325},[1663,1666,1670,1682,1686,1689,1716,1738,1742,1754,1805,1818,1822,1828,1904,1907,1914,2037,2079,2083,2091,2102,2109,2117,2162,2168,2177,2212,2215,2221,2228,2233,2261,2287,2291,2323],[1076,1664,575],{"id":1665},"constructors-this-worked-example",[1080,1667,1669],{"id":1668},"problem","Problem",[1085,1671,1672,1673,1675,1676,1679,1680,1625],{},"Model a single drivetrain motor for a robot. It needs a ",[1094,1674,1441],{}," and a ",[1094,1677,1678],{},"speed",". Teammates should be able to build a motor by specifying both the port and a starting speed, or by specifying just the port — in which case the motor starts stopped, at speed ",[1094,1681,1181],{},[1080,1683,1685],{"id":1684},"step-1-sketch-the-class-and-its-fields","Step 1: Sketch the Class and Its Fields",[1085,1687,1688],{},"Start with just the instance variables — no constructor yet:",[1099,1690,1692],{"className":1101,"code":1691,"language":1103,"meta":1104,"style":1104},"public class DriveMotor\n{\n    private int motorPort;\n    private double speed;\n}\n",[1094,1693,1694,1699,1703,1707,1712],{"__ignoreMap":1104},[1108,1695,1696],{"class":1110,"line":1111},[1108,1697,1698],{},"public class DriveMotor\n",[1108,1700,1701],{"class":1110,"line":1117},[1108,1702,1120],{},[1108,1704,1705],{"class":1110,"line":1123},[1108,1706,1126],{},[1108,1708,1709],{"class":1110,"line":1129},[1108,1710,1711],{},"    private double speed;\n",[1108,1713,1714],{"class":1110,"line":1136},[1108,1715,1163],{},[1085,1717,1718,1720,1721,1723,1724,1720,1726,1728,1729,1720,1731,1733,1734,1737],{},[1094,1719,1441],{}," and ",[1094,1722,1678],{}," already start at ",[1094,1725,1173],{},[1094,1727,1181],{}," — the defaults for ",[1094,1730,1177],{},[1094,1732,1184],{}," — the instant a ",[1094,1735,1736],{},"DriveMotor"," exists, whether or not any constructor runs. This class has no constructor written at all, so Java adds a free no-argument one behind the scenes, but it doesn't do anything beyond that automatic default-initialization. That's not useful here — a motor with no known port isn't in a valid state — so the next steps replace it.",[1080,1739,1741],{"id":1740},"step-2-write-the-two-argument-constructor","Step 2: Write the Two-Argument Constructor",[1085,1743,1744,1745,1747,1748,1750,1751,1753],{},"A constructor's job is to leave the object in a valid state. This one takes both values a motor needs and assigns them. Naming the parameters the same as the instance variables makes the constructor read clearly — the tradeoff is that ",[1094,1746,1441],{}," (the parameter) now shadows ",[1094,1749,1441],{}," (the instance variable), so ",[1094,1752,1427],{}," is required to reach the instance variable:",[1099,1755,1757],{"className":1101,"code":1756,"language":1103,"meta":1104,"style":1104},"public class DriveMotor\n{\n    private int motorPort;\n    private double speed;\n\n    public DriveMotor(int motorPort, double speed) \u002F\u002F same name as the class, no return type\n    {\n        this.motorPort = motorPort;\n        this.speed = speed;\n    }\n}\n",[1094,1758,1759,1763,1767,1771,1775,1779,1784,1788,1792,1797,1801],{"__ignoreMap":1104},[1108,1760,1761],{"class":1110,"line":1111},[1108,1762,1698],{},[1108,1764,1765],{"class":1110,"line":1117},[1108,1766,1120],{},[1108,1768,1769],{"class":1110,"line":1123},[1108,1770,1126],{},[1108,1772,1773],{"class":1110,"line":1129},[1108,1774,1711],{},[1108,1776,1777],{"class":1110,"line":1136},[1108,1778,1133],{"emptyLinePlaceholder":1132},[1108,1780,1781],{"class":1110,"line":1142},[1108,1782,1783],{},"    public DriveMotor(int motorPort, double speed) \u002F\u002F same name as the class, no return type\n",[1108,1785,1786],{"class":1110,"line":1148},[1108,1787,1145],{},[1108,1789,1790],{"class":1110,"line":1154},[1108,1791,1151],{},[1108,1793,1794],{"class":1110,"line":1160},[1108,1795,1796],{},"        this.speed = speed;\n",[1108,1798,1799],{"class":1110,"line":1274},[1108,1800,1157],{},[1108,1802,1803],{"class":1110,"line":1279},[1108,1804,1163],{},[1085,1806,1807,1438,1809,1811,1812,1814,1815,1817],{},[1094,1808,1437],{},[1094,1810,1441],{},"\"; the bare ",[1094,1813,1441],{}," on the right is the parameter. The moment this constructor exists, the free default constructor from Step 1 is gone — ",[1094,1816,1736],{}," now only builds the way this constructor says it can.",[1080,1819,1821],{"id":1820},"step-3-add-an-overloaded-constructor-for-a-default-speed","Step 3: Add an Overloaded Constructor for a Default Speed",[1085,1823,1824,1825,1827],{},"A teammate building a motor that should just start stopped shouldn't have to type ",[1094,1826,1181],{}," every time. Add a second constructor, distinguished by its parameter list — the same overloading concept as overloaded methods (Ch.4.1):",[1099,1829,1831],{"className":1101,"code":1830,"language":1103,"meta":1104,"style":1104},"public class DriveMotor\n{\n    private int motorPort;\n    private double speed;\n\n    public DriveMotor(int motorPort, double speed)\n    {\n        this.motorPort = motorPort;\n        this.speed = speed;\n    }\n\n    public DriveMotor(int motorPort)\n    {\n        this.motorPort = motorPort;\n        this.speed = 0.0; \u002F\u002F sensible default: starts stopped\n    }\n}\n",[1094,1832,1833,1837,1841,1845,1849,1853,1858,1862,1866,1870,1874,1878,1883,1887,1891,1896,1900],{"__ignoreMap":1104},[1108,1834,1835],{"class":1110,"line":1111},[1108,1836,1698],{},[1108,1838,1839],{"class":1110,"line":1117},[1108,1840,1120],{},[1108,1842,1843],{"class":1110,"line":1123},[1108,1844,1126],{},[1108,1846,1847],{"class":1110,"line":1129},[1108,1848,1711],{},[1108,1850,1851],{"class":1110,"line":1136},[1108,1852,1133],{"emptyLinePlaceholder":1132},[1108,1854,1855],{"class":1110,"line":1142},[1108,1856,1857],{},"    public DriveMotor(int motorPort, double speed)\n",[1108,1859,1860],{"class":1110,"line":1148},[1108,1861,1145],{},[1108,1863,1864],{"class":1110,"line":1154},[1108,1865,1151],{},[1108,1867,1868],{"class":1110,"line":1160},[1108,1869,1796],{},[1108,1871,1872],{"class":1110,"line":1274},[1108,1873,1157],{},[1108,1875,1876],{"class":1110,"line":1279},[1108,1877,1133],{"emptyLinePlaceholder":1132},[1108,1879,1880],{"class":1110,"line":1284},[1108,1881,1882],{},"    public DriveMotor(int motorPort)\n",[1108,1884,1885],{"class":1110,"line":1290},[1108,1886,1145],{},[1108,1888,1889],{"class":1110,"line":1295},[1108,1890,1151],{},[1108,1892,1893],{"class":1110,"line":1300},[1108,1894,1895],{},"        this.speed = 0.0; \u002F\u002F sensible default: starts stopped\n",[1108,1897,1898],{"class":1110,"line":1306},[1108,1899,1157],{},[1108,1901,1902],{"class":1110,"line":1311},[1108,1903,1163],{},[1085,1905,1906],{},"Both constructors leave the object in a valid state — they just differ in how much the caller has to supply.",[1080,1908,1910,1911],{"id":1909},"step-4-put-it-together-in-main","Step 4: Put It Together in ",[1094,1912,1913],{},"main",[1099,1915,1917],{"className":1101,"code":1916,"language":1103,"meta":1104,"style":1104},"public class DriveMotor\n{\n    private int motorPort;\n    private double speed;\n\n    public DriveMotor(int motorPort, double speed)\n    {\n        this.motorPort = motorPort;\n        this.speed = speed;\n    }\n\n    public DriveMotor(int motorPort)\n    {\n        this.motorPort = motorPort;\n        this.speed = 0.0; \u002F\u002F sensible default: starts stopped\n    }\n\n    public static void main(String[] args)\n    {\n        DriveMotor leftDrive = new DriveMotor(3, 0.8);   \u002F\u002F port 3, starts at 0.8\n        DriveMotor rightDrive = new DriveMotor(5);        \u002F\u002F port 5, starts stopped\n\n        System.out.println(\"Left drive  - port: \" + leftDrive.motorPort + \", speed: \" + leftDrive.speed);\n        System.out.println(\"Right drive - port: \" + rightDrive.motorPort + \", speed: \" + rightDrive.speed);\n    }\n}\n",[1094,1918,1919,1923,1927,1931,1935,1939,1943,1947,1951,1955,1959,1963,1967,1971,1975,1979,1983,1987,1993,1998,2004,2010,2015,2021,2027,2032],{"__ignoreMap":1104},[1108,1920,1921],{"class":1110,"line":1111},[1108,1922,1698],{},[1108,1924,1925],{"class":1110,"line":1117},[1108,1926,1120],{},[1108,1928,1929],{"class":1110,"line":1123},[1108,1930,1126],{},[1108,1932,1933],{"class":1110,"line":1129},[1108,1934,1711],{},[1108,1936,1937],{"class":1110,"line":1136},[1108,1938,1133],{"emptyLinePlaceholder":1132},[1108,1940,1941],{"class":1110,"line":1142},[1108,1942,1857],{},[1108,1944,1945],{"class":1110,"line":1148},[1108,1946,1145],{},[1108,1948,1949],{"class":1110,"line":1154},[1108,1950,1151],{},[1108,1952,1953],{"class":1110,"line":1160},[1108,1954,1796],{},[1108,1956,1957],{"class":1110,"line":1274},[1108,1958,1157],{},[1108,1960,1961],{"class":1110,"line":1279},[1108,1962,1133],{"emptyLinePlaceholder":1132},[1108,1964,1965],{"class":1110,"line":1284},[1108,1966,1882],{},[1108,1968,1969],{"class":1110,"line":1290},[1108,1970,1145],{},[1108,1972,1973],{"class":1110,"line":1295},[1108,1974,1151],{},[1108,1976,1977],{"class":1110,"line":1300},[1108,1978,1895],{},[1108,1980,1981],{"class":1110,"line":1306},[1108,1982,1157],{},[1108,1984,1985],{"class":1110,"line":1311},[1108,1986,1133],{"emptyLinePlaceholder":1132},[1108,1988,1990],{"class":1110,"line":1989},18,[1108,1991,1992],{},"    public static void main(String[] args)\n",[1108,1994,1996],{"class":1110,"line":1995},19,[1108,1997,1145],{},[1108,1999,2001],{"class":1110,"line":2000},20,[1108,2002,2003],{},"        DriveMotor leftDrive = new DriveMotor(3, 0.8);   \u002F\u002F port 3, starts at 0.8\n",[1108,2005,2007],{"class":1110,"line":2006},21,[1108,2008,2009],{},"        DriveMotor rightDrive = new DriveMotor(5);        \u002F\u002F port 5, starts stopped\n",[1108,2011,2013],{"class":1110,"line":2012},22,[1108,2014,1133],{"emptyLinePlaceholder":1132},[1108,2016,2018],{"class":1110,"line":2017},23,[1108,2019,2020],{},"        System.out.println(\"Left drive  - port: \" + leftDrive.motorPort + \", speed: \" + leftDrive.speed);\n",[1108,2022,2024],{"class":1110,"line":2023},24,[1108,2025,2026],{},"        System.out.println(\"Right drive - port: \" + rightDrive.motorPort + \", speed: \" + rightDrive.speed);\n",[1108,2028,2030],{"class":1110,"line":2029},25,[1108,2031,1157],{},[1108,2033,2035],{"class":1110,"line":2034},26,[1108,2036,1163],{},[1085,2038,2039,2042,2043,2046,2047,2049,2050,2052,2053,1720,2055,2057,2058,2061,2062,2064,2065,2068,2069,2072,2073,2075,2076,2078],{},[1094,2040,2041],{},"leftDrive"," is built with the two-argument constructor from Step 2; ",[1094,2044,2045],{},"rightDrive"," is built with the one-argument constructor from Step 3. Java picks which constructor runs by matching the argument list at the ",[1094,2048,1593],{}," call — that's overload resolution, the same as for methods. ",[1094,2051,1913],{}," can read ",[1094,2054,1441],{},[1094,2056,1678],{}," straight off either object even though both fields are ",[1094,2059,2060],{},"private",": ",[1094,2063,2060],{}," hides a field from ",[1412,2066,2067],{},"other"," classes, not from other methods of the ",[1412,2070,2071],{},"same"," class, and this ",[1094,2074,1913],{}," lives inside ",[1094,2077,1736],{}," itself.",[1080,2080,2082],{"id":2081},"what-it-prints","What It Prints",[1099,2084,2089],{"className":2085,"code":2087,"language":2088},[2086],"language-text","Left drive  - port: 3, speed: 0.8\nRight drive - port: 5, speed: 0.0\n","text",[1094,2090,2087],{"__ignoreMap":1104},[1085,2092,2093,2095,2096,2098,2099,2101],{},[1094,2094,2045],{}," never had a speed passed in, so its ",[1094,2097,1678],{}," shows the ",[1094,2100,1181],{}," default from Step 3 instead.",[1080,2103,2105,2106,2108],{"id":2104},"step-5-pass-this-to-another-method","Step 5: Pass ",[1094,2107,1427],{}," to Another Method",[1085,2110,2111,2113,2114,2116],{},[1094,2112,1427],{}," isn't just for disambiguating fields — it's a full reference to the current object, so it can be passed anywhere an object of that type is expected, like any other argument. Add one static method that logs any ",[1094,2115,1736],{},", and one instance method that hands itself over:",[1099,2118,2120],{"className":1101,"code":2119,"language":1103,"meta":1104,"style":1104},"public static void logStatus(DriveMotor motor)\n{\n    System.out.println(\"[LOG] port \" + motor.motorPort + \", speed \" + motor.speed);\n}\n\npublic void reportStatus()\n{\n    logStatus(this); \u002F\u002F pass the current object itself\n}\n",[1094,2121,2122,2127,2131,2136,2140,2144,2149,2153,2158],{"__ignoreMap":1104},[1108,2123,2124],{"class":1110,"line":1111},[1108,2125,2126],{},"public static void logStatus(DriveMotor motor)\n",[1108,2128,2129],{"class":1110,"line":1117},[1108,2130,1120],{},[1108,2132,2133],{"class":1110,"line":1123},[1108,2134,2135],{},"    System.out.println(\"[LOG] port \" + motor.motorPort + \", speed \" + motor.speed);\n",[1108,2137,2138],{"class":1110,"line":1129},[1108,2139,1163],{},[1108,2141,2142],{"class":1110,"line":1136},[1108,2143,1133],{"emptyLinePlaceholder":1132},[1108,2145,2146],{"class":1110,"line":1142},[1108,2147,2148],{},"public void reportStatus()\n",[1108,2150,2151],{"class":1110,"line":1148},[1108,2152,1120],{},[1108,2154,2155],{"class":1110,"line":1154},[1108,2156,2157],{},"    logStatus(this); \u002F\u002F pass the current object itself\n",[1108,2159,2160],{"class":1110,"line":1160},[1108,2161,1163],{},[1085,2163,2164,2165,2167],{},"Then call it from ",[1094,2166,1913],{},":",[1099,2169,2171],{"className":1101,"code":2170,"language":1103,"meta":1104,"style":1104},"leftDrive.reportStatus();\n",[1094,2172,2173],{"__ignoreMap":1104},[1108,2174,2175],{"class":1110,"line":1111},[1108,2176,2170],{},[1085,2178,2179,2182,2183,2185,2186,2188,2189,2191,2192,2195,2196,1720,2199,2202,2203,2205,2206,2208,2209,2211],{},[1094,2180,2181],{},"reportStatus()"," doesn't build a new ",[1094,2184,1736],{}," or know its own port\u002Fspeed by name — it just hands ",[1094,2187,1427],{}," (whichever ",[1094,2190,1736],{}," it was called on) to ",[1094,2193,2194],{},"logStatus",", which reads ",[1094,2197,2198],{},"motor.motorPort",[1094,2200,2201],{},"motor.speed"," off whatever object it was given. ",[1094,2204,2194],{}," is ",[1094,2207,1485],{},", so it has no ",[1094,2210,1427],{}," of its own — it only knows about the motor because one was passed in.",[1085,2213,2214],{},"Output adds one line:",[1099,2216,2219],{"className":2217,"code":2218,"language":2088},[2086],"[LOG] port 3, speed 0.8\n",[1094,2220,2218],{"__ignoreMap":1104},[1080,2222,2224,2225,2227],{"id":2223},"what-forgetting-this-would-look-like","What Forgetting ",[1094,2226,1427],{}," Would Look Like",[1085,2229,2230,2231,2167],{},"If Step 2's constructor had been written without ",[1094,2232,1427],{},[1099,2234,2236],{"className":1101,"code":2235,"language":1103,"meta":1104,"style":1104},"public DriveMotor(int motorPort, double speed)\n{\n    motorPort = motorPort; \u002F\u002F bug: parameter assigned to itself\n    speed = speed;         \u002F\u002F bug: parameter assigned to itself\n}\n",[1094,2237,2238,2243,2247,2252,2257],{"__ignoreMap":1104},[1108,2239,2240],{"class":1110,"line":1111},[1108,2241,2242],{},"public DriveMotor(int motorPort, double speed)\n",[1108,2244,2245],{"class":1110,"line":1117},[1108,2246,1120],{},[1108,2248,2249],{"class":1110,"line":1123},[1108,2250,2251],{},"    motorPort = motorPort; \u002F\u002F bug: parameter assigned to itself\n",[1108,2253,2254],{"class":1110,"line":1129},[1108,2255,2256],{},"    speed = speed;         \u002F\u002F bug: parameter assigned to itself\n",[1108,2258,2259],{"class":1110,"line":1136},[1108,2260,1163],{},[1085,2262,2263,2264,1720,2266,2268,2269,2271,2272,2274,2275,2277,2278,2280,2281,2283,2284,2286],{},"Both lines compile — ",[1094,2265,1441],{},[1094,2267,1678],{}," are valid names on both sides. But without ",[1094,2270,1427],{},", the compiler always means the closest name in scope, which is the parameter. ",[1094,2273,1476],{}," just assigns the parameter to itself; the instance variable ",[1094,2276,1441],{}," never gets touched and stays at its default, ",[1094,2279,1173],{},". Every ",[1094,2282,1736],{}," built this way would silently think it's on port ",[1094,2285,1173],{},", no matter what the caller passed in — and nothing about it would look wrong until the robot tried to drive the wrong motor.",[1080,2288,2290],{"id":2289},"recap","Recap",[1550,2292,2293,2295,2297,2300,2305,2311],{},[1553,2294,1603],{},[1553,2296,1606],{},[1553,2298,2299],{},"Constructors can be overloaded, just like methods, distinguished by parameter lists.",[1553,2301,2302,2304],{},[1094,2303,1427],{}," refers to the current object inside an instance method or constructor — essential for disambiguating a parameter from an instance variable of the same name.",[1553,2306,2307,2308,2310],{},"Java picks which overloaded constructor runs by matching the argument list at the ",[1094,2309,1593],{}," call — the same overload resolution used for methods.",[1553,2312,2313,2315,2316,2319,2320,2322],{},[1094,2314,1427],{}," can be passed as an argument, like any other object reference — ",[1094,2317,2318],{},"logStatus(this)"," hands the current object to a method that takes one. Static methods have no ",[1094,2321,1427],{}," of their own.",[1637,2324,1639],{},{"title":1104,"searchDepth":1117,"depth":1117,"links":2326},[2327,2328,2329,2330,2331,2333,2334,2336,2338],{"id":1668,"depth":1117,"text":1669},{"id":1684,"depth":1117,"text":1685},{"id":1740,"depth":1117,"text":1741},{"id":1820,"depth":1117,"text":1821},{"id":1909,"depth":1117,"text":2332},"Step 4: Put It Together in main",{"id":2081,"depth":1117,"text":2082},{"id":2104,"depth":1117,"text":2335},"Step 5: Pass this to Another Method",{"id":2223,"depth":1117,"text":2337},"What Forgetting this Would Look Like",{"id":2289,"depth":1117,"text":2290},{"outlineRef":1655,"pairsWith":2340,"status":2341},"[`lessons\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this.md`](..\u002F..\u002Flessons\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this.md)","new — authored worked example (fully solved, walked step by step — not a problem to attempt)",{"title":575,"description":1104},"FWkr6oYP1sye-A0mR3yRM2Q1m3_iMe3SwK9XeUe5kDQ",{"id":2345,"title":884,"body":2346,"description":1104,"extension":1653,"meta":3506,"navigation":1132,"path":883,"seo":3508,"stem":885,"__hash__":3509},"exercises\u002Fshockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this.md",{"type":1073,"value":2347,"toc":3501},[2348,2351,2355,2365,2436,2442,2447,2470,2476,2512,2532,2536,2551,2554,2623,2628,2634,2700,2777,2781,2787,2807,2832,2845,2859,2876,2881,3086,3091,3096,3102,3107,3113,3118,3122,3128,3132,3138,3143,3147,3153,3157,3163,3168,3172,3178,3182,3188,3193,3197,3203,3207,3213,3218,3458,3499],[1076,2349,884],{"id":2350},"constructors-this-exercises",[1080,2352,2354],{"id":2353},"multiple-choice","Multiple Choice",[1085,2356,2357,2360,2361,2364],{},[1089,2358,2359],{},"Question:"," A teammate writes this ",[1094,2362,2363],{},"Intake"," class:",[1099,2366,2368],{"className":1101,"code":2367,"language":1103,"meta":1104,"style":1104},"public class Intake\n{\n    private int rollerPort;\n\n    public Intake(int rollerPort)\n    {\n        rollerPort = rollerPort;\n    }\n\n    public static void main(String[] args)\n    {\n        Intake front = new Intake(3);\n        System.out.println(front.rollerPort);\n    }\n}\n",[1094,2369,2370,2375,2379,2384,2388,2393,2397,2402,2406,2410,2414,2418,2423,2428,2432],{"__ignoreMap":1104},[1108,2371,2372],{"class":1110,"line":1111},[1108,2373,2374],{},"public class Intake\n",[1108,2376,2377],{"class":1110,"line":1117},[1108,2378,1120],{},[1108,2380,2381],{"class":1110,"line":1123},[1108,2382,2383],{},"    private int rollerPort;\n",[1108,2385,2386],{"class":1110,"line":1129},[1108,2387,1133],{"emptyLinePlaceholder":1132},[1108,2389,2390],{"class":1110,"line":1136},[1108,2391,2392],{},"    public Intake(int rollerPort)\n",[1108,2394,2395],{"class":1110,"line":1142},[1108,2396,1145],{},[1108,2398,2399],{"class":1110,"line":1148},[1108,2400,2401],{},"        rollerPort = rollerPort;\n",[1108,2403,2404],{"class":1110,"line":1154},[1108,2405,1157],{},[1108,2407,2408],{"class":1110,"line":1160},[1108,2409,1133],{"emptyLinePlaceholder":1132},[1108,2411,2412],{"class":1110,"line":1274},[1108,2413,1992],{},[1108,2415,2416],{"class":1110,"line":1279},[1108,2417,1145],{},[1108,2419,2420],{"class":1110,"line":1284},[1108,2421,2422],{},"        Intake front = new Intake(3);\n",[1108,2424,2425],{"class":1110,"line":1290},[1108,2426,2427],{},"        System.out.println(front.rollerPort);\n",[1108,2429,2430],{"class":1110,"line":1295},[1108,2431,1157],{},[1108,2433,2434],{"class":1110,"line":1300},[1108,2435,1163],{},[1085,2437,2438,2439,2441],{},"What does ",[1094,2440,1913],{}," print?",[1085,2443,2444],{},[1089,2445,2446],{},"Options:",[1550,2448,2449,2455,2460,2463],{},[1553,2450,2451,2452],{},"A. ",[1094,2453,2454],{},"3",[1553,2456,2457,2458],{},"B. ",[1094,2459,1173],{},[1553,2461,2462],{},"C. It won't compile",[1553,2464,2465,2466,2469],{},"D. It depends on where ",[1094,2467,2468],{},"rollerPort"," is declared in the class",[1085,2471,2472,2475],{},[1089,2473,2474],{},"Answer:"," B",[1085,2477,2478,2481,2482,1178,2484,2487,2488,2490,2491,2493,2494,2496,2497,2499,2500,2502,2503,2505,2506,2508,2509,2511],{},[1089,2479,2480],{},"Why:"," Without ",[1094,2483,1427],{},[1094,2485,2486],{},"rollerPort = rollerPort;"," assigns the parameter to itself — the closest name in scope on both sides is the parameter, not the instance variable. The instance variable ",[1094,2489,2468],{}," is never touched, so it stays at its default value for an ",[1094,2492,1177],{},", which is ",[1094,2495,1173],{},". ",[1094,2498,1913],{}," can read the ",[1094,2501,2060],{}," field directly because it lives inside ",[1094,2504,2363],{}," itself — ",[1094,2507,2060],{}," only blocks ",[1412,2510,2067],{}," classes.",[1550,2513,2514,2517,2523],{},[1553,2515,2516],{},"A is wrong — it assumes the assignment reached the instance variable, but it never does; that's exactly the bug.",[1553,2518,2519,2520,2522],{},"C is wrong — both sides of ",[1094,2521,2486],{}," are valid names (the parameter), so this compiles cleanly. The bug is silent, not a compiler error.",[1553,2524,2525,2526,2528,2529,2531],{},"D is wrong — a field's default value doesn't depend on where it's declared in the class; an unset ",[1094,2527,1177],{}," field is always ",[1094,2530,1173],{}," regardless of position.",[1080,2533,2535],{"id":2534},"micro-parsons","Micro-Parsons",[1085,2537,2538,2541,2542,2545,2546,2548,2549,1625],{},[1089,2539,2540],{},"Problem:"," These lines, once correctly ordered, form a complete program that builds one ",[1094,2543,2544],{},"Shooter"," and prints the wheel port it was given, using ",[1094,2547,1427],{}," to correctly set the field from the constructor's parameter of the same name. Order the class body as: the field first, then the constructor, then ",[1094,2550,1913],{},[1085,2552,2553],{},"Reorder the fragments below into a working program:",[1550,2555,2556,2562,2568,2574,2580,2586,2592,2598,2603,2609,2615],{},[1553,2557,2558,2559],{},"a. ",[1094,2560,2561],{},"    public static void main(String[] args)",[1553,2563,2564,2565],{},"b. ",[1094,2566,2567],{},"    private int wheelPort;",[1553,2569,2570,2571],{},"c. ",[1094,2572,2573],{},"public class Shooter",[1553,2575,2576,2577],{},"d. ",[1094,2578,2579],{},"        System.out.println(\"Wheel port: \" + new Shooter(4).wheelPort);",[1553,2581,2582,2583],{},"e. ",[1094,2584,2585],{},"{",[1553,2587,2588,2589],{},"f. ",[1094,2590,2591],{},"    public Shooter(int wheelPort)",[1553,2593,2594,2595],{},"g. ",[1094,2596,2597],{},"    {",[1553,2599,2600,2601],{},"h. ",[1094,2602,2597],{},[1553,2604,2605,2606],{},"i. ",[1094,2607,2608],{},"        this.wheelPort = wheelPort;",[1553,2610,2611,2612],{},"j. ",[1094,2613,2614],{},"    }",[1553,2616,2617,2618,1631,2620],{},"k. ",[1094,2619,2614],{},[1094,2621,2622],{},"}",[1085,2624,2625,2627],{},[1089,2626,2474],{}," c, e, b, f, g, i, j, a, h, d, k",[1085,2629,2630,2633],{},[1089,2631,2632],{},"Interchangeable:"," (g, h)",[1099,2635,2637],{"className":1101,"code":2636,"language":1103,"meta":1104,"style":1104},"public class Shooter\n{\n    private int wheelPort;\n\n    public Shooter(int wheelPort)\n    {\n        this.wheelPort = wheelPort;\n    }\n\n    public static void main(String[] args)\n    {\n        System.out.println(\"Wheel port: \" + new Shooter(4).wheelPort);\n    }\n}\n",[1094,2638,2639,2644,2648,2653,2657,2662,2666,2671,2675,2679,2683,2687,2692,2696],{"__ignoreMap":1104},[1108,2640,2641],{"class":1110,"line":1111},[1108,2642,2643],{},"public class Shooter\n",[1108,2645,2646],{"class":1110,"line":1117},[1108,2647,1120],{},[1108,2649,2650],{"class":1110,"line":1123},[1108,2651,2652],{},"    private int wheelPort;\n",[1108,2654,2655],{"class":1110,"line":1129},[1108,2656,1133],{"emptyLinePlaceholder":1132},[1108,2658,2659],{"class":1110,"line":1136},[1108,2660,2661],{},"    public Shooter(int wheelPort)\n",[1108,2663,2664],{"class":1110,"line":1142},[1108,2665,1145],{},[1108,2667,2668],{"class":1110,"line":1148},[1108,2669,2670],{},"        this.wheelPort = wheelPort;\n",[1108,2672,2673],{"class":1110,"line":1154},[1108,2674,1157],{},[1108,2676,2677],{"class":1110,"line":1160},[1108,2678,1133],{"emptyLinePlaceholder":1132},[1108,2680,2681],{"class":1110,"line":1274},[1108,2682,1992],{},[1108,2684,2685],{"class":1110,"line":1279},[1108,2686,1145],{},[1108,2688,2689],{"class":1110,"line":1284},[1108,2690,2691],{},"        System.out.println(\"Wheel port: \" + new Shooter(4).wheelPort);\n",[1108,2693,2694],{"class":1110,"line":1290},[1108,2695,1157],{},[1108,2697,2698],{"class":1110,"line":1295},[1108,2699,1163],{},[1085,2701,2702,2705,2706,2708,2709,2711,2712,2715,2716,2719,2720,2723,2724,2727,2728,2731,2732,2735,2736,2739,2740,2743,2744,2747,2748,2750,2751,2753,2754,2757,2758,2761,2762,1720,2764,2766,2767,2769,2770,2772,2773,2776],{},[1089,2703,2704],{},"Why this order:"," The Problem text pins the required order — field, then constructor, then ",[1094,2707,1913],{}," — so follow that rather than guessing from what Java itself would accept (Java doesn't actually require ",[1094,2710,1913],{}," to come after the constructor, but this puzzle does). The class line (",[1094,2713,2714],{},"c",") comes first with its opening brace (",[1094,2717,2718],{},"e",") right after. The field (",[1094,2721,2722],{},"b",") is declared before the constructor that uses it. The constructor's signature (",[1094,2725,2726],{},"f",") and its opening brace (",[1094,2729,2730],{},"g",") stay as separate one-line fragments, and its single statement (",[1094,2733,2734],{},"i",") and closing brace (",[1094,2737,2738],{},"j",") stay separate too — ",[1094,2741,2742],{},"this.wheelPort = wheelPort;"," is the only line that can actually reach the instance variable, since the parameter ",[1094,2745,2746],{},"wheelPort"," shadows the field and the left-hand side needs ",[1094,2749,1427],{}," to mean something different from the right-hand side; that's the exact placement this lesson is testing, so it's kept fully granular rather than fused away. ",[1094,2752,1913],{}," (",[1094,2755,2756],{},"a",") is declared next, with its own opening brace (",[1094,2759,2760],{},"h",") kept as a separate fragment — ",[1094,2763,2730],{},[1094,2765,2760],{}," are textually identical (",[1094,2768,2597],{},"), which is why they're declared Interchangeable: whichever physical fragment lands in which slot, the reassembled program reads the same either way. Only at the very end is there a truly forced pair: once ",[1094,2771,1913],{},"'s closing brace is placed, the class's closing brace is the only fragment left with nowhere else it could go, so those two are fused into one fragment (",[1094,2774,2775],{},"k",").",[1080,2778,2780],{"id":2779},"coding","Coding",[1085,2782,2783,2786],{},[1089,2784,2785],{},"Mode:"," full-program",[1085,2788,2789,2791,2792,2794,2795,2797,2798,2800,2801,2803,2804,2167],{},[1089,2790,2540],{}," Write the class ",[1094,2793,1326],{}," with two ",[1094,2796,2060],{}," instance variables, a motor port (",[1094,2799,1177],{},") and a climb\nspeed (",[1094,2802,1184],{},"), and two ",[1089,2805,2806],{},"overloaded constructors",[1550,2808,2809,2815],{},[1553,2810,2811,2814],{},[1094,2812,2813],{},"Climber(int motorPort, double climbSpeed)"," sets both values.",[1553,2816,2817,2820,2821,2824,2825,2828,2829,2831],{},[1094,2818,2819],{},"Climber(int motorPort)"," uses a default climb speed of ",[1094,2822,2823],{},"0.5",". It must ",[1089,2826,2827],{},"delegate"," to the two-argument\nconstructor with ",[1094,2830,1320],{}," instead of repeating its code.",[1085,2833,2834,2835,2838,2839,1720,2842,1625],{},"Both parameters use the same names as the instance variables, so use ",[1094,2836,2837],{},"this."," to tell them apart. Add the\ntwo getters ",[1094,2840,2841],{},"getMotorPort()",[1094,2843,2844],{},"getClimbSpeed()",[1085,2846,2847,2848,2850,2851,2854,2855,2858],{},"The fixed ",[1094,2849,1913],{}," reads a number of climbers; each is either ",[1094,2852,2853],{},"default \u003Cport>"," or ",[1094,2856,2857],{},"custom \u003Cport> \u003Cspeed>",".\nIt builds each one and prints its two values.",[1085,2860,2861,2862,2865,2866,2869,2870,2865,2873,1625],{},"For example, ",[1094,2863,2864],{},"default 4"," prints ",[1094,2867,2868],{},"port 4, speed 0.5",", and ",[1094,2871,2872],{},"custom 7 0.8",[1094,2874,2875],{},"port 7, speed 0.8",[1085,2877,2878],{},[1089,2879,2880],{},"Starter:",[1099,2882,2884],{"className":1101,"code":2883,"language":1103,"meta":1104,"style":1104},"import java.util.*;\n\npublic class Main\n{\n    \u002F\u002F Don't change main\n    public static void main(String[] args)\n    {\n        Scanner in = new Scanner(System.in);\n        int count = in.nextInt();\n        for (int i = 0; i \u003C count; i++)\n        {\n            String kind = in.next();\n            int port = in.nextInt();\n            Climber climber;\n            if (kind.equals(\"default\"))\n            {\n                climber = new Climber(port);\n            }\n            else\n            {\n                double speed = in.nextDouble();\n                climber = new Climber(port, speed);\n            }\n            System.out.println(\"port \" + climber.getMotorPort() + \", speed \" + climber.getClimbSpeed());\n        }\n    }\n}\n\nclass Climber\n{\n    \u002F\u002F TODO: private instance variables for the motor port and the climb speed\n\n    \u002F\u002F TODO: a constructor Climber(int motorPort) that uses a climb speed of 0.5\n    \u002F\u002F       (delegate to the other constructor with this(...) instead of repeating code)\n\n    \u002F\u002F TODO: a constructor Climber(int motorPort, double climbSpeed)\n    \u002F\u002F       (the parameters share the fields' names, so use this.)\n\n    \u002F\u002F TODO: getMotorPort() and getClimbSpeed()\n}\n",[1094,2885,2886,2891,2895,2900,2904,2909,2913,2917,2922,2927,2932,2937,2942,2947,2952,2957,2962,2967,2972,2977,2981,2986,2991,2995,3000,3005,3009,3014,3019,3025,3030,3036,3041,3047,3053,3058,3064,3070,3075,3081],{"__ignoreMap":1104},[1108,2887,2888],{"class":1110,"line":1111},[1108,2889,2890],{},"import java.util.*;\n",[1108,2892,2893],{"class":1110,"line":1117},[1108,2894,1133],{"emptyLinePlaceholder":1132},[1108,2896,2897],{"class":1110,"line":1123},[1108,2898,2899],{},"public class Main\n",[1108,2901,2902],{"class":1110,"line":1129},[1108,2903,1120],{},[1108,2905,2906],{"class":1110,"line":1136},[1108,2907,2908],{},"    \u002F\u002F Don't change main\n",[1108,2910,2911],{"class":1110,"line":1142},[1108,2912,1992],{},[1108,2914,2915],{"class":1110,"line":1148},[1108,2916,1145],{},[1108,2918,2919],{"class":1110,"line":1154},[1108,2920,2921],{},"        Scanner in = new Scanner(System.in);\n",[1108,2923,2924],{"class":1110,"line":1160},[1108,2925,2926],{},"        int count = in.nextInt();\n",[1108,2928,2929],{"class":1110,"line":1274},[1108,2930,2931],{},"        for (int i = 0; i \u003C count; i++)\n",[1108,2933,2934],{"class":1110,"line":1279},[1108,2935,2936],{},"        {\n",[1108,2938,2939],{"class":1110,"line":1284},[1108,2940,2941],{},"            String kind = in.next();\n",[1108,2943,2944],{"class":1110,"line":1290},[1108,2945,2946],{},"            int port = in.nextInt();\n",[1108,2948,2949],{"class":1110,"line":1295},[1108,2950,2951],{},"            Climber climber;\n",[1108,2953,2954],{"class":1110,"line":1300},[1108,2955,2956],{},"            if (kind.equals(\"default\"))\n",[1108,2958,2959],{"class":1110,"line":1306},[1108,2960,2961],{},"            {\n",[1108,2963,2964],{"class":1110,"line":1311},[1108,2965,2966],{},"                climber = new Climber(port);\n",[1108,2968,2969],{"class":1110,"line":1989},[1108,2970,2971],{},"            }\n",[1108,2973,2974],{"class":1110,"line":1995},[1108,2975,2976],{},"            else\n",[1108,2978,2979],{"class":1110,"line":2000},[1108,2980,2961],{},[1108,2982,2983],{"class":1110,"line":2006},[1108,2984,2985],{},"                double speed = in.nextDouble();\n",[1108,2987,2988],{"class":1110,"line":2012},[1108,2989,2990],{},"                climber = new Climber(port, speed);\n",[1108,2992,2993],{"class":1110,"line":2017},[1108,2994,2971],{},[1108,2996,2997],{"class":1110,"line":2023},[1108,2998,2999],{},"            System.out.println(\"port \" + climber.getMotorPort() + \", speed \" + climber.getClimbSpeed());\n",[1108,3001,3002],{"class":1110,"line":2029},[1108,3003,3004],{},"        }\n",[1108,3006,3007],{"class":1110,"line":2034},[1108,3008,1157],{},[1108,3010,3012],{"class":1110,"line":3011},27,[1108,3013,1163],{},[1108,3015,3017],{"class":1110,"line":3016},28,[1108,3018,1133],{"emptyLinePlaceholder":1132},[1108,3020,3022],{"class":1110,"line":3021},29,[1108,3023,3024],{},"class Climber\n",[1108,3026,3028],{"class":1110,"line":3027},30,[1108,3029,1120],{},[1108,3031,3033],{"class":1110,"line":3032},31,[1108,3034,3035],{},"    \u002F\u002F TODO: private instance variables for the motor port and the climb speed\n",[1108,3037,3039],{"class":1110,"line":3038},32,[1108,3040,1133],{"emptyLinePlaceholder":1132},[1108,3042,3044],{"class":1110,"line":3043},33,[1108,3045,3046],{},"    \u002F\u002F TODO: a constructor Climber(int motorPort) that uses a climb speed of 0.5\n",[1108,3048,3050],{"class":1110,"line":3049},34,[1108,3051,3052],{},"    \u002F\u002F       (delegate to the other constructor with this(...) instead of repeating code)\n",[1108,3054,3056],{"class":1110,"line":3055},35,[1108,3057,1133],{"emptyLinePlaceholder":1132},[1108,3059,3061],{"class":1110,"line":3060},36,[1108,3062,3063],{},"    \u002F\u002F TODO: a constructor Climber(int motorPort, double climbSpeed)\n",[1108,3065,3067],{"class":1110,"line":3066},37,[1108,3068,3069],{},"    \u002F\u002F       (the parameters share the fields' names, so use this.)\n",[1108,3071,3073],{"class":1110,"line":3072},38,[1108,3074,1133],{"emptyLinePlaceholder":1132},[1108,3076,3078],{"class":1110,"line":3077},39,[1108,3079,3080],{},"    \u002F\u002F TODO: getMotorPort() and getClimbSpeed()\n",[1108,3082,3084],{"class":1110,"line":3083},40,[1108,3085,1163],{},[1085,3087,3088],{},[1089,3089,3090],{},"Scenario 1 (visible):",[1085,3092,3093],{},[1089,3094,3095],{},"Input:",[1099,3097,3100],{"className":3098,"code":3099,"language":2088,"meta":1104},[2086],"2\ndefault 4\ncustom 7 0.8\n",[1094,3101,3099],{"__ignoreMap":1104},[1085,3103,3104],{},[1089,3105,3106],{},"Expected output:",[1099,3108,3111],{"className":3109,"code":3110,"language":2088,"meta":1104},[2086],"port 4, speed 0.5\nport 7, speed 0.8\n",[1094,3112,3110],{"__ignoreMap":1104},[1085,3114,3115],{},[1089,3116,3117],{},"Scenario 2 (visible):",[1085,3119,3120],{},[1089,3121,3095],{},[1099,3123,3126],{"className":3124,"code":3125,"language":2088,"meta":1104},[2086],"1\ncustom 2 1.0\n",[1094,3127,3125],{"__ignoreMap":1104},[1085,3129,3130],{},[1089,3131,3106],{},[1099,3133,3136],{"className":3134,"code":3135,"language":2088,"meta":1104},[2086],"port 2, speed 1.0\n",[1094,3137,3135],{"__ignoreMap":1104},[1085,3139,3140],{},[1089,3141,3142],{},"Scenario 3 (visible):",[1085,3144,3145],{},[1089,3146,3095],{},[1099,3148,3151],{"className":3149,"code":3150,"language":2088,"meta":1104},[2086],"1\ndefault 0\n",[1094,3152,3150],{"__ignoreMap":1104},[1085,3154,3155],{},[1089,3156,3106],{},[1099,3158,3161],{"className":3159,"code":3160,"language":2088,"meta":1104},[2086],"port 0, speed 0.5\n",[1094,3162,3160],{"__ignoreMap":1104},[1085,3164,3165],{},[1089,3166,3167],{},"Scenario 4 (hidden):",[1085,3169,3170],{},[1089,3171,3095],{},[1099,3173,3176],{"className":3174,"code":3175,"language":2088,"meta":1104},[2086],"3\ncustom 9 0.25\ndefault 9\ncustom 1 0.0\n",[1094,3177,3175],{"__ignoreMap":1104},[1085,3179,3180],{},[1089,3181,3106],{},[1099,3183,3186],{"className":3184,"code":3185,"language":2088,"meta":1104},[2086],"port 9, speed 0.25\nport 9, speed 0.5\nport 1, speed 0.0\n",[1094,3187,3185],{"__ignoreMap":1104},[1085,3189,3190],{},[1089,3191,3192],{},"Scenario 5 (hidden):",[1085,3194,3195],{},[1089,3196,3095],{},[1099,3198,3201],{"className":3199,"code":3200,"language":2088,"meta":1104},[2086],"2\ndefault 12\ndefault 3\n",[1094,3202,3200],{"__ignoreMap":1104},[1085,3204,3205],{},[1089,3206,3106],{},[1099,3208,3211],{"className":3209,"code":3210,"language":2088,"meta":1104},[2086],"port 12, speed 0.5\nport 3, speed 0.5\n",[1094,3212,3210],{"__ignoreMap":1104},[1085,3214,3215],{},[1089,3216,3217],{},"Solution:",[1099,3219,3221],{"className":1101,"code":3220,"language":1103,"meta":1104,"style":1104},"import java.util.*;\n\npublic class Main\n{\n    \u002F\u002F Don't change main\n    public static void main(String[] args)\n    {\n        Scanner in = new Scanner(System.in);\n        int count = in.nextInt();\n        for (int i = 0; i \u003C count; i++)\n        {\n            String kind = in.next();\n            int port = in.nextInt();\n            Climber climber;\n            if (kind.equals(\"default\"))\n            {\n                climber = new Climber(port);\n            }\n            else\n            {\n                double speed = in.nextDouble();\n                climber = new Climber(port, speed);\n            }\n            System.out.println(\"port \" + climber.getMotorPort() + \", speed \" + climber.getClimbSpeed());\n        }\n    }\n}\n\nclass Climber\n{\n    private int motorPort;\n    private double climbSpeed;\n\n    public Climber(int motorPort)\n    {\n        this(motorPort, 0.5);\n    }\n\n    public Climber(int motorPort, double climbSpeed)\n    {\n        this.motorPort = motorPort;\n        this.climbSpeed = climbSpeed;\n    }\n\n    public int getMotorPort()\n    {\n        return motorPort;\n    }\n\n    public double getClimbSpeed()\n    {\n        return climbSpeed;\n    }\n}\n",[1094,3222,3223,3227,3231,3235,3239,3243,3247,3251,3255,3259,3263,3267,3271,3275,3279,3283,3287,3291,3295,3299,3303,3307,3311,3315,3319,3323,3327,3331,3335,3339,3343,3347,3351,3355,3359,3363,3368,3372,3376,3380,3384,3389,3394,3399,3404,3410,3415,3421,3426,3431,3437,3442,3448,3453],{"__ignoreMap":1104},[1108,3224,3225],{"class":1110,"line":1111},[1108,3226,2890],{},[1108,3228,3229],{"class":1110,"line":1117},[1108,3230,1133],{"emptyLinePlaceholder":1132},[1108,3232,3233],{"class":1110,"line":1123},[1108,3234,2899],{},[1108,3236,3237],{"class":1110,"line":1129},[1108,3238,1120],{},[1108,3240,3241],{"class":1110,"line":1136},[1108,3242,2908],{},[1108,3244,3245],{"class":1110,"line":1142},[1108,3246,1992],{},[1108,3248,3249],{"class":1110,"line":1148},[1108,3250,1145],{},[1108,3252,3253],{"class":1110,"line":1154},[1108,3254,2921],{},[1108,3256,3257],{"class":1110,"line":1160},[1108,3258,2926],{},[1108,3260,3261],{"class":1110,"line":1274},[1108,3262,2931],{},[1108,3264,3265],{"class":1110,"line":1279},[1108,3266,2936],{},[1108,3268,3269],{"class":1110,"line":1284},[1108,3270,2941],{},[1108,3272,3273],{"class":1110,"line":1290},[1108,3274,2946],{},[1108,3276,3277],{"class":1110,"line":1295},[1108,3278,2951],{},[1108,3280,3281],{"class":1110,"line":1300},[1108,3282,2956],{},[1108,3284,3285],{"class":1110,"line":1306},[1108,3286,2961],{},[1108,3288,3289],{"class":1110,"line":1311},[1108,3290,2966],{},[1108,3292,3293],{"class":1110,"line":1989},[1108,3294,2971],{},[1108,3296,3297],{"class":1110,"line":1995},[1108,3298,2976],{},[1108,3300,3301],{"class":1110,"line":2000},[1108,3302,2961],{},[1108,3304,3305],{"class":1110,"line":2006},[1108,3306,2985],{},[1108,3308,3309],{"class":1110,"line":2012},[1108,3310,2990],{},[1108,3312,3313],{"class":1110,"line":2017},[1108,3314,2971],{},[1108,3316,3317],{"class":1110,"line":2023},[1108,3318,2999],{},[1108,3320,3321],{"class":1110,"line":2029},[1108,3322,3004],{},[1108,3324,3325],{"class":1110,"line":2034},[1108,3326,1157],{},[1108,3328,3329],{"class":1110,"line":3011},[1108,3330,1163],{},[1108,3332,3333],{"class":1110,"line":3016},[1108,3334,1133],{"emptyLinePlaceholder":1132},[1108,3336,3337],{"class":1110,"line":3021},[1108,3338,3024],{},[1108,3340,3341],{"class":1110,"line":3027},[1108,3342,1120],{},[1108,3344,3345],{"class":1110,"line":3032},[1108,3346,1126],{},[1108,3348,3349],{"class":1110,"line":3038},[1108,3350,1249],{},[1108,3352,3353],{"class":1110,"line":3043},[1108,3354,1133],{"emptyLinePlaceholder":1132},[1108,3356,3357],{"class":1110,"line":3049},[1108,3358,1258],{},[1108,3360,3361],{"class":1110,"line":3055},[1108,3362,1145],{},[1108,3364,3365],{"class":1110,"line":3060},[1108,3366,3367],{},"        this(motorPort, 0.5);\n",[1108,3369,3370],{"class":1110,"line":3066},[1108,3371,1157],{},[1108,3373,3374],{"class":1110,"line":3072},[1108,3375,1133],{"emptyLinePlaceholder":1132},[1108,3377,3378],{"class":1110,"line":3077},[1108,3379,1287],{},[1108,3381,3382],{"class":1110,"line":3083},[1108,3383,1145],{},[1108,3385,3387],{"class":1110,"line":3386},41,[1108,3388,1151],{},[1108,3390,3392],{"class":1110,"line":3391},42,[1108,3393,1303],{},[1108,3395,3397],{"class":1110,"line":3396},43,[1108,3398,1157],{},[1108,3400,3402],{"class":1110,"line":3401},44,[1108,3403,1133],{"emptyLinePlaceholder":1132},[1108,3405,3407],{"class":1110,"line":3406},45,[1108,3408,3409],{},"    public int getMotorPort()\n",[1108,3411,3413],{"class":1110,"line":3412},46,[1108,3414,1145],{},[1108,3416,3418],{"class":1110,"line":3417},47,[1108,3419,3420],{},"        return motorPort;\n",[1108,3422,3424],{"class":1110,"line":3423},48,[1108,3425,1157],{},[1108,3427,3429],{"class":1110,"line":3428},49,[1108,3430,1133],{"emptyLinePlaceholder":1132},[1108,3432,3434],{"class":1110,"line":3433},50,[1108,3435,3436],{},"    public double getClimbSpeed()\n",[1108,3438,3440],{"class":1110,"line":3439},51,[1108,3441,1145],{},[1108,3443,3445],{"class":1110,"line":3444},52,[1108,3446,3447],{},"        return climbSpeed;\n",[1108,3449,3451],{"class":1110,"line":3450},53,[1108,3452,1157],{},[1108,3454,3456],{"class":1110,"line":3455},54,[1108,3457,1163],{},[1085,3459,3460,3462,3463,3465,3466,1178,3468,3470,3471,3473,3474,3476,3477,3480,3481,3484,3485,3488,3489,3491,3492,3494,3495,3498],{},[1089,3461,2480],{}," In the two-argument constructor, ",[1094,3464,1330],{}," copies the parameter into the instance\nvariable. Without ",[1094,3467,2837],{},[1094,3469,1476],{}," assigns the parameter to itself and the field stays at\nits default ",[1094,3472,1173],{}," \u002F ",[1094,3475,1181],{},", so every line would print ",[1094,3478,3479],{},"port 0, speed 0.0",". The one-argument constructor is a\nsingle line, ",[1094,3482,3483],{},"this(motorPort, 0.5);",", which must be the first statement; that is why a ",[1094,3486,3487],{},"default"," climber\nstill gets its port set as well as the ",[1094,3490,2823],{}," speed. Writing ",[1094,3493,1585],{}," instead would make an\nordinary method, not a constructor, and ",[1094,3496,3497],{},"new Climber(port)"," would then not compile.",[1637,3500,1639],{},{"title":1104,"searchDepth":1117,"depth":1117,"links":3502},[3503,3504,3505],{"id":2353,"depth":1117,"text":2354},{"id":2534,"depth":1117,"text":2535},{"id":2779,"depth":1117,"text":2780},{"outlineRef":1655,"pairsWith":2340,"status":3507},"new — authored exercises (Multiple Choice + Micro-Parsons + Coding)",{"title":884,"description":1104},"bGAUn7KEO12OK5X3uCL-UzK5RnFzM2vS2W_vy4VkZfE",1792718165874]