[{"data":1,"prerenderedAt":3369},["ShallowReactive",2],{"\u002Fblog\u002FData-Structure-Concept-Revision":3,"post-count":2956,"series-global-data":2957,"authors-all":3072,"series-sidebar-none":3267,"sidebar-authors":3268},{"id":4,"title":5,"author":6,"body":7,"date":2945,"description":125,"draft":2946,"edited_at":2945,"extension":2947,"featured_image":2948,"meta":2949,"navigation":2950,"path":2951,"pinned":2946,"seo":2952,"sitemap":2953,"stem":2954,"tags":2948,"__hash__":2955},"blog\u002Fblog\u002FData-Structure-Concept-Revision.md","Data Structure Concept Revision","chinono",{"type":8,"value":9,"toc":2907},"minimark",[10,15,20,29,32,68,72,79,82,93,107,116,119,294,297,333,336,343,346,380,384,387,408,414,458,464,488,492,498,525,529,532,573,580,583,690,697,708,714,717,733,798,802,805,830,851,855,859,865,871,885,892,900,903,907,911,914,939,943,1026,1044,1047,1096,1100,1106,1157,1170,1188,1191,1214,1227,1231,1234,1244,1332,1346,1435,1445,1449,1462,1502,1526,1530,1543,1560,1563,1805,1808,1814,1836,1849,1853,1861,1948,1959,1963,1967,1986,1993,1997,2011,2080,2086,2090,2246,2250,2260,2287,2291,2330,2337,2393,2403,2407,2410,2445,2493,2496,2529,2533,2550,2652,2658,2662,2743,2746,2781,2785,2788,2897,2900,2903],[11,12,14],"h2",{"id":13},"part-1-objects-and-classes","Part 1: Objects and Classes",[16,17,19],"h3",{"id":18},"what-is-an-object","What is an \"object\"?",[21,22,23,24,28],"p",{},"Forget code for a second. Look around you — a chair, a phone, a cup of coffee. Each of those is an ",[25,26,27],"strong",{},"object",". In programming, an object is also a \"thing\", just a digital one. It represents some entity we want to model in our program.",[21,30,31],{},"Every object has three properties:",[33,34,35,42,48,54,61],"ul",{},[36,37,38,41],"li",{},[25,39,40],{},"A unique identity"," — it's distinguishable from other objects, even similar ones. Two identical-looking mugs are still two separate mugs.",[36,43,44,47],{},[25,45,46],{},"State"," — the data that describes it. A mug's state might include its color, its volume, and whether it's currently full.",[36,49,50,53],{},[25,51,52],{},"Behavior"," — the things it can do. A mug can be filled, emptied, or washed.\nIn Java terms:",[36,55,56,57,60],{},"State is stored in ",[25,58,59],{},"data fields"," (also called variables, properties, or attributes).",[36,62,63,64,67],{},"Behavior is implemented as ",[25,65,66],{},"methods"," (functions that belong to the object).",[16,69,71],{"id":70},"what-is-a-class","What is a \"class\"?",[21,73,74,75,78],{},"If an object is a real thing, a ",[25,76,77],{},"class"," is the blueprint that describes what that thing looks like.",[21,80,81],{},"Think of a class like a cookie cutter, and objects like the cookies. The cutter (class) defines the shape, but you can stamp out as many cookies (objects) as you like, each one its own individual piece.",[21,83,84,85,88,89,92],{},"Or in more formal terms: a class is a ",[25,86,87],{},"template"," or ",[25,90,91],{},"contract"," that defines what data fields and methods every object of that type will have.",[94,95,96],"blockquote",{},[21,97,98,101,102,106],{},[25,99,100],{},"Key idea:"," An object is an ",[103,104,105],"em",{},"instance"," of a class. You can create many objects from one class.",[16,108,110,111,115],{"id":109},"a-first-example-the-circle-class","A first example: the ",[112,113,114],"code",{},"Circle"," class",[21,117,118],{},"Let's model circles. Every circle has a radius and can compute its area.",[120,121,126],"pre",{"className":122,"code":123,"language":124,"meta":125,"style":125},"language-java shiki shiki-themes github-light github-dark","class Circle {\n    \u002F** The radius of this circle *\u002F\n    double radius = 1.0;\n \n    \u002F** Construct a circle object with default radius *\u002F\n    Circle() {\n    }\n \n    \u002F** Construct a circle object with a given radius *\u002F\n    Circle(double newRadius) {\n        radius = newRadius;\n    }\n \n    \u002F** Return the area of this circle *\u002F\n    double getArea() {\n        return radius * radius * 3.14159;\n    }\n}\n","java","",[112,127,128,144,151,170,176,182,191,197,202,208,226,237,242,247,253,263,283,288],{"__ignoreMap":125},[129,130,133,136,140],"span",{"class":131,"line":132},"line",1,[129,134,77],{"class":135},"szBVR",[129,137,139],{"class":138},"sScJk"," Circle",[129,141,143],{"class":142},"sVt8B"," {\n",[129,145,147],{"class":131,"line":146},2,[129,148,150],{"class":149},"sJ8bj","    \u002F** The radius of this circle *\u002F\n",[129,152,154,157,160,163,167],{"class":131,"line":153},3,[129,155,156],{"class":135},"    double",[129,158,159],{"class":142}," radius ",[129,161,162],{"class":135},"=",[129,164,166],{"class":165},"sj4cs"," 1.0",[129,168,169],{"class":142},";\n",[129,171,173],{"class":131,"line":172},4,[129,174,175],{"class":142}," \n",[129,177,179],{"class":131,"line":178},5,[129,180,181],{"class":149},"    \u002F** Construct a circle object with default radius *\u002F\n",[129,183,185,188],{"class":131,"line":184},6,[129,186,187],{"class":138},"    Circle",[129,189,190],{"class":142},"() {\n",[129,192,194],{"class":131,"line":193},7,[129,195,196],{"class":142},"    }\n",[129,198,200],{"class":131,"line":199},8,[129,201,175],{"class":142},[129,203,205],{"class":131,"line":204},9,[129,206,207],{"class":149},"    \u002F** Construct a circle object with a given radius *\u002F\n",[129,209,211,213,216,219,223],{"class":131,"line":210},10,[129,212,187],{"class":138},[129,214,215],{"class":142},"(",[129,217,218],{"class":135},"double",[129,220,222],{"class":221},"s4XuR"," newRadius",[129,224,225],{"class":142},") {\n",[129,227,229,232,234],{"class":131,"line":228},11,[129,230,231],{"class":142},"        radius ",[129,233,162],{"class":135},[129,235,236],{"class":142}," newRadius;\n",[129,238,240],{"class":131,"line":239},12,[129,241,196],{"class":142},[129,243,245],{"class":131,"line":244},13,[129,246,175],{"class":142},[129,248,250],{"class":131,"line":249},14,[129,251,252],{"class":149},"    \u002F** Return the area of this circle *\u002F\n",[129,254,256,258,261],{"class":131,"line":255},15,[129,257,156],{"class":135},[129,259,260],{"class":138}," getArea",[129,262,190],{"class":142},[129,264,266,269,271,274,276,278,281],{"class":131,"line":265},16,[129,267,268],{"class":135},"        return",[129,270,159],{"class":142},[129,272,273],{"class":135},"*",[129,275,159],{"class":142},[129,277,273],{"class":135},[129,279,280],{"class":165}," 3.14159",[129,282,169],{"class":142},[129,284,286],{"class":131,"line":285},17,[129,287,196],{"class":142},[129,289,291],{"class":131,"line":290},18,[129,292,293],{"class":142},"}\n",[21,295,296],{},"Three pieces here:",[33,298,299,309,319],{},[36,300,301,304,305,308],{},[112,302,303],{},"radius"," is the ",[25,306,307],{},"data field"," (the state).",[36,310,311,314,315,318],{},[112,312,313],{},"getArea()"," is a ",[25,316,317],{},"method"," (the behavior).",[36,320,321,324,325,328,329,332],{},[112,322,323],{},"Circle()"," and ",[112,326,327],{},"Circle(double newRadius)"," are ",[25,330,331],{},"constructors",".",[16,334,335],{"id":331},"Constructors",[21,337,338,339,342],{},"A ",[25,340,341],{},"constructor"," is a special method that runs when you create a new object. It \"constructs\" the object — sets it up, gives it initial values.",[21,344,345],{},"Three important rules:",[347,348,349,355,365],"ol",{},[36,350,351,352,332],{},"The constructor's name ",[25,353,354],{},"must match the class name exactly",[36,356,357,358,361,362,332],{},"It has ",[25,359,360],{},"no return type"," — not even ",[112,363,364],{},"void",[36,366,367,368,371,372,375,376,379],{},"It's invoked using the ",[112,369,370],{},"new"," keyword.\nA constructor with no parameters is called a ",[25,373,374],{},"no-arg constructor",". If you write a class without ",[103,377,378],{},"any"," constructor at all, Java quietly gives you a free default no-arg constructor with an empty body. But the moment you write even one constructor yourself, that freebie disappears — Java won't make one for you anymore.",[16,381,383],{"id":382},"creating-objects","Creating objects",[21,385,386],{},"The pattern looks like this:",[120,388,390],{"className":122,"code":389,"language":124,"meta":125,"style":125},"ClassName variableName = new ClassName();\n",[112,391,392],{"__ignoreMap":125},[129,393,394,397,399,402,405],{"class":131,"line":132},[129,395,396],{"class":142},"ClassName variableName ",[129,398,162],{"class":135},[129,400,401],{"class":135}," new",[129,403,404],{"class":138}," ClassName",[129,406,407],{"class":142},"();\n",[21,409,410,411,413],{},"So for our ",[112,412,114],{},":",[120,415,417],{"className":122,"code":416,"language":124,"meta":125,"style":125},"Circle myCircle = new Circle();           \u002F\u002F uses no-arg constructor, radius = 1.0\nCircle bigCircle = new Circle(25);        \u002F\u002F uses the other constructor, radius = 25\n",[112,418,419,436],{"__ignoreMap":125},[129,420,421,424,426,428,430,433],{"class":131,"line":132},[129,422,423],{"class":142},"Circle myCircle ",[129,425,162],{"class":135},[129,427,401],{"class":135},[129,429,139],{"class":138},[129,431,432],{"class":142},"();           ",[129,434,435],{"class":149},"\u002F\u002F uses no-arg constructor, radius = 1.0\n",[129,437,438,441,443,445,447,449,452,455],{"class":131,"line":146},[129,439,440],{"class":142},"Circle bigCircle ",[129,442,162],{"class":135},[129,444,401],{"class":135},[129,446,139],{"class":138},[129,448,215],{"class":142},[129,450,451],{"class":165},"25",[129,453,454],{"class":142},");        ",[129,456,457],{"class":149},"\u002F\u002F uses the other constructor, radius = 25\n",[21,459,460,463],{},[112,461,462],{},"new Circle()"," actually does two things:",[347,465,466,469],{},[36,467,468],{},"Creates a new circle object in memory.",[36,470,471,472,475,476,479,480,483,484,487],{},"Returns a ",[103,473,474],{},"reference"," to it.\nThat reference is what gets stored in ",[112,477,478],{},"myCircle",". The variable doesn't ",[103,481,482],{},"contain"," the object — it ",[103,485,486],{},"points to"," it. This distinction matters, as we'll see in a moment.",[16,489,491],{"id":490},"accessing-an-objects-members","Accessing an object's members",[21,493,494,495,497],{},"Once you have an object, use the dot (",[112,496,332],{},") operator:",[120,499,501],{"className":122,"code":500,"language":124,"meta":125,"style":125},"myCircle.radius          \u002F\u002F read the data field\nmyCircle.getArea()       \u002F\u002F invoke a method\n",[112,502,503,511],{"__ignoreMap":125},[129,504,505,508],{"class":131,"line":132},[129,506,507],{"class":142},"myCircle.radius          ",[129,509,510],{"class":149},"\u002F\u002F read the data field\n",[129,512,513,516,519,522],{"class":131,"line":146},[129,514,515],{"class":142},"myCircle.",[129,517,518],{"class":138},"getArea",[129,520,521],{"class":142},"()       ",[129,523,524],{"class":149},"\u002F\u002F invoke a method\n",[16,526,528],{"id":527},"primitive-types-vs-object-types","Primitive types vs. object types",[21,530,531],{},"Java has two flavors of variables:",[120,533,535],{"className":122,"code":534,"language":124,"meta":125,"style":125},"int i = 1;               \u002F\u002F primitive: i directly holds the value 1\nCircle c = new Circle(); \u002F\u002F object: c holds a reference pointing to the Circle\n",[112,536,537,556],{"__ignoreMap":125},[129,538,539,542,545,547,550,553],{"class":131,"line":132},[129,540,541],{"class":135},"int",[129,543,544],{"class":142}," i ",[129,546,162],{"class":135},[129,548,549],{"class":165}," 1",[129,551,552],{"class":142},";               ",[129,554,555],{"class":149},"\u002F\u002F primitive: i directly holds the value 1\n",[129,557,558,561,563,565,567,570],{"class":131,"line":146},[129,559,560],{"class":142},"Circle c ",[129,562,162],{"class":135},[129,564,401],{"class":135},[129,566,139],{"class":138},[129,568,569],{"class":142},"(); ",[129,571,572],{"class":149},"\u002F\u002F object: c holds a reference pointing to the Circle\n",[21,574,575,576,579],{},"For primitives, the variable ",[103,577,578],{},"is"," the value. For objects, the variable is a \"pointer\" to the object stored somewhere else in memory.",[21,581,582],{},"This becomes important when you assign one variable to another:",[120,584,586],{"className":122,"code":585,"language":124,"meta":125,"style":125},"\u002F\u002F Primitives — copies the value\nint i = 1, j = 2;\ni = j;   \u002F\u002F now i = 2, j = 2. Two independent copies.\n \n\u002F\u002F Objects — copies the reference, not the object\nCircle c1 = new Circle(5);\nCircle c2 = new Circle(9);\nc1 = c2;  \u002F\u002F c1 now points to the same object as c2 (radius 9)\n          \u002F\u002F The old radius-5 circle is now unreachable — garbage.\n",[112,587,588,593,613,626,630,635,654,672,685],{"__ignoreMap":125},[129,589,590],{"class":131,"line":132},[129,591,592],{"class":149},"\u002F\u002F Primitives — copies the value\n",[129,594,595,597,599,601,603,606,608,611],{"class":131,"line":146},[129,596,541],{"class":135},[129,598,544],{"class":142},[129,600,162],{"class":135},[129,602,549],{"class":165},[129,604,605],{"class":142},", j ",[129,607,162],{"class":135},[129,609,610],{"class":165}," 2",[129,612,169],{"class":142},[129,614,615,618,620,623],{"class":131,"line":153},[129,616,617],{"class":142},"i ",[129,619,162],{"class":135},[129,621,622],{"class":142}," j;   ",[129,624,625],{"class":149},"\u002F\u002F now i = 2, j = 2. Two independent copies.\n",[129,627,628],{"class":131,"line":172},[129,629,175],{"class":142},[129,631,632],{"class":131,"line":178},[129,633,634],{"class":149},"\u002F\u002F Objects — copies the reference, not the object\n",[129,636,637,640,642,644,646,648,651],{"class":131,"line":184},[129,638,639],{"class":142},"Circle c1 ",[129,641,162],{"class":135},[129,643,401],{"class":135},[129,645,139],{"class":138},[129,647,215],{"class":142},[129,649,650],{"class":165},"5",[129,652,653],{"class":142},");\n",[129,655,656,659,661,663,665,667,670],{"class":131,"line":193},[129,657,658],{"class":142},"Circle c2 ",[129,660,162],{"class":135},[129,662,401],{"class":135},[129,664,139],{"class":138},[129,666,215],{"class":142},[129,668,669],{"class":165},"9",[129,671,653],{"class":142},[129,673,674,677,679,682],{"class":131,"line":199},[129,675,676],{"class":142},"c1 ",[129,678,162],{"class":135},[129,680,681],{"class":142}," c2;  ",[129,683,684],{"class":149},"\u002F\u002F c1 now points to the same object as c2 (radius 9)\n",[129,686,687],{"class":131,"line":204},[129,688,689],{"class":149},"          \u002F\u002F The old radius-5 circle is now unreachable — garbage.\n",[21,691,692,693,696],{},"Java will eventually clean up that \"garbage\" object automatically. That's the ",[25,694,695],{},"garbage collector"," doing its job.",[16,698,700,701,704,705],{"id":699},"visibility-modifiers-public-vs-private","Visibility modifiers: ",[112,702,703],{},"public"," vs. ",[112,706,707],{},"private",[21,709,710,711,332],{},"By default, a class member (a field or method) is accessible to any class in the ",[25,712,713],{},"same package",[21,715,716],{},"Two important modifiers change this:",[33,718,719,726],{},[36,720,721,725],{},[25,722,723],{},[112,724,703],{}," — visible everywhere. Any class, any package.",[36,727,728,732],{},[25,729,730],{},[112,731,707],{}," — visible only inside the class that declares it.",[120,734,736],{"className":122,"code":735,"language":124,"meta":125,"style":125},"public class Account {\n    private double balance;   \u002F\u002F hidden from the outside\n \n    public double getBalance() {   \u002F\u002F controlled access\n        return balance;\n    }\n}\n",[112,737,738,749,763,767,783,790,794],{"__ignoreMap":125},[129,739,740,742,744,747],{"class":131,"line":132},[129,741,703],{"class":135},[129,743,115],{"class":135},[129,745,746],{"class":138}," Account",[129,748,143],{"class":142},[129,750,751,754,757,760],{"class":131,"line":146},[129,752,753],{"class":135},"    private",[129,755,756],{"class":135}," double",[129,758,759],{"class":142}," balance;   ",[129,761,762],{"class":149},"\u002F\u002F hidden from the outside\n",[129,764,765],{"class":131,"line":153},[129,766,175],{"class":142},[129,768,769,772,774,777,780],{"class":131,"line":172},[129,770,771],{"class":135},"    public",[129,773,756],{"class":135},[129,775,776],{"class":138}," getBalance",[129,778,779],{"class":142},"() {   ",[129,781,782],{"class":149},"\u002F\u002F controlled access\n",[129,784,785,787],{"class":131,"line":178},[129,786,268],{"class":135},[129,788,789],{"class":142}," balance;\n",[129,791,792],{"class":131,"line":184},[129,793,196],{"class":142},[129,795,796],{"class":131,"line":193},[129,797,293],{"class":142},[16,799,801],{"id":800},"why-should-data-fields-be-private","Why should data fields be private?",[21,803,804],{},"This is one of the most important habits in OOP. Two reasons:",[347,806,807,817],{},[36,808,809,812,813,816],{},[25,810,811],{},"To protect data."," If ",[112,814,815],{},"balance"," were public, any code anywhere could set it to a negative billion. Making it private forces callers to go through methods you control — methods that can validate, log, or refuse the change.",[36,818,819,822,823,324,826,829],{},[25,820,821],{},"To make the class easy to maintain."," If you later decide to store the balance differently (say, in cents instead of dollars), only the inside of the class changes. Code that uses the class via ",[112,824,825],{},"getBalance()",[112,827,828],{},"setBalance()"," doesn't have to be rewritten.\nThese controlled-access methods have standard names:",[33,831,832,841],{},[36,833,834,837,838,840],{},[25,835,836],{},"Accessor"," (getter): ",[112,839,825],{}," — reads a private field.",[36,842,843,846,847,850],{},[25,844,845],{},"Mutator"," (setter): ",[112,848,849],{},"setBalance(double value)"," — modifies a private field.",[11,852,854],{"id":853},"part-2-thinking-in-objects","Part 2: Thinking in Objects",[16,856,858],{"id":857},"abstraction-and-encapsulation","Abstraction and encapsulation",[21,860,861,862],{},"These are the two big ideas behind \"thinking in objects\". They sound abstract (no pun intended), but they boil down to one principle: ",[25,863,864],{},"hide the messy details, expose a clean interface.",[21,866,867,870],{},[25,868,869],{},"Encapsulation"," means bundling data and the methods that operate on it inside a single unit (a class), and hiding the internal state behind private fields. The outside world only talks to the class through its public methods.",[21,872,873,876,877,880,881,884],{},[25,874,875],{},"Abstraction"," means separating ",[103,878,879],{},"what"," a class does from ",[103,882,883],{},"how"," it does it. As the user of a class, you only need to know its public contract — the method signatures. You don't need to read the implementation.",[21,886,887,888,891],{},"Think of a TV remote. You press the volume button. You don't care whether the remote uses infrared, Bluetooth, or magic — you just care that the volume changes. The remote ",[103,889,890],{},"abstracts away"," the complexity.",[120,893,898],{"className":894,"code":896,"language":897},[895],"language-text","[ Class implementation ]  \u003C--->  [ Class Contract ]  \u003C--->  [ Clients ]\n   (hidden, black box)        (public methods\u002Fconstants)   (the users)\n","text",[112,899,896],{"__ignoreMap":125},[21,901,902],{},"When you design a class, ask: \"What's the smallest, cleanest interface I can expose that still lets users do what they need?\" Everything else stays private.",[11,904,906],{"id":905},"part-3-inheritance-and-polymorphism","Part 3: Inheritance and Polymorphism",[16,908,910],{"id":909},"the-motivation-avoid-repeating-yourself","The motivation: avoid repeating yourself",[21,912,913],{},"Suppose I want to model circles, rectangles, and triangles. All three share things: a color, whether they're filled, the date they were created. If I write that information into each class separately, I'll have three copies of the same code. If I later want to add an \"outline thickness\" property, I'd have to update all three.",[21,915,916,919,920,923,924,926,927,930,931,934,935,938],{},[25,917,918],{},"Inheritance"," solves this. We define a general class first — say, ",[112,921,922],{},"GeometricObject"," — that holds the shared stuff. Then ",[112,925,114],{},", ",[112,928,929],{},"Rectangle",", and ",[112,932,933],{},"Triangle"," ",[103,936,937],{},"extend"," it, inheriting everything it has.",[16,940,942],{"id":941},"superclass-and-subclass","Superclass and subclass",[120,944,946],{"className":122,"code":945,"language":124,"meta":125,"style":125},"class GeometricObject {\n    private String color = \"white\";\n    private boolean filled;\n    \u002F\u002F ...constructors, getters, setters...\n}\n \nclass Circle extends GeometricObject {\n    private double radius;\n    \u002F\u002F ...inherits color, filled, etc. for free...\n}\n",[112,947,948,957,972,982,987,991,995,1008,1017,1022],{"__ignoreMap":125},[129,949,950,952,955],{"class":131,"line":132},[129,951,77],{"class":135},[129,953,954],{"class":138}," GeometricObject",[129,956,143],{"class":142},[129,958,959,961,964,966,970],{"class":131,"line":146},[129,960,753],{"class":135},[129,962,963],{"class":142}," String color ",[129,965,162],{"class":135},[129,967,969],{"class":968},"sZZnC"," \"white\"",[129,971,169],{"class":142},[129,973,974,976,979],{"class":131,"line":153},[129,975,753],{"class":135},[129,977,978],{"class":135}," boolean",[129,980,981],{"class":142}," filled;\n",[129,983,984],{"class":131,"line":172},[129,985,986],{"class":149},"    \u002F\u002F ...constructors, getters, setters...\n",[129,988,989],{"class":131,"line":178},[129,990,293],{"class":142},[129,992,993],{"class":131,"line":184},[129,994,175],{"class":142},[129,996,997,999,1001,1004,1006],{"class":131,"line":193},[129,998,77],{"class":135},[129,1000,139],{"class":138},[129,1002,1003],{"class":135}," extends",[129,1005,954],{"class":138},[129,1007,143],{"class":142},[129,1009,1010,1012,1014],{"class":131,"line":199},[129,1011,753],{"class":135},[129,1013,756],{"class":135},[129,1015,1016],{"class":142}," radius;\n",[129,1018,1019],{"class":131,"line":204},[129,1020,1021],{"class":149},"    \u002F\u002F ...inherits color, filled, etc. for free...\n",[129,1023,1024],{"class":131,"line":210},[129,1025,293],{"class":142},[21,1027,1028,304,1030,1033,1034,304,1036,1039,1040,1043],{},[112,1029,922],{},[25,1031,1032],{},"superclass"," (parent), and ",[112,1035,114],{},[25,1037,1038],{},"subclass"," (child). The ",[112,1041,1042],{},"extends"," keyword sets up the relationship.",[21,1045,1046],{},"A few important facts:",[33,1048,1049,1060,1067,1074,1085],{},[36,1050,1051,1052,1055,1056,1059],{},"A subclass is ",[25,1053,1054],{},"not"," simply a subset of a superclass. In fact, a subclass usually has ",[103,1057,1058],{},"more"," than its parent — it adds its own fields and methods on top.",[36,1061,1062,1063,1066],{},"Private members of the superclass are ",[25,1064,1065],{},"not directly accessible"," in the subclass. You have to go through public getters\u002Fsetters.",[36,1068,1069,1070,1073],{},"Classes are ",[25,1071,1072],{},"extensible"," — you can keep extending subclasses to make new ones.",[36,1075,1076,1077,1080,1081,1084],{},"Java does ",[25,1078,1079],{},"not allow multiple inheritance"," for classes. A class can only extend ",[103,1082,1083],{},"one"," superclass. (Interfaces are the workaround — more on that later.)",[36,1086,1087,1088,1091,1092,1095],{},"Superclass ",[25,1089,1090],{},"constructors are not inherited",", but they ",[103,1093,1094],{},"are"," automatically invoked.",[16,1097,1099],{"id":1098},"calling-the-superclass-constructor","Calling the superclass constructor",[21,1101,1102,1103,413],{},"To explicitly invoke the parent's constructor, use ",[112,1104,1105],{},"super",[120,1107,1109],{"className":122,"code":1108,"language":124,"meta":125,"style":125},"public Circle(double radius, String color, boolean filled) {\n    super(color, filled);   \u002F\u002F calls GeometricObject's constructor\n    this.radius = radius;\n}\n",[112,1110,1111,1130,1141,1153],{"__ignoreMap":125},[129,1112,1113,1115,1117,1119,1121,1124,1127],{"class":131,"line":132},[129,1114,703],{"class":135},[129,1116,139],{"class":138},[129,1118,215],{"class":142},[129,1120,218],{"class":135},[129,1122,1123],{"class":142}," radius, String color, ",[129,1125,1126],{"class":135},"boolean",[129,1128,1129],{"class":142}," filled) {\n",[129,1131,1132,1135,1138],{"class":131,"line":146},[129,1133,1134],{"class":165},"    super",[129,1136,1137],{"class":142},"(color, filled);   ",[129,1139,1140],{"class":149},"\u002F\u002F calls GeometricObject's constructor\n",[129,1142,1143,1146,1149,1151],{"class":131,"line":153},[129,1144,1145],{"class":165},"    this",[129,1147,1148],{"class":142},".radius ",[129,1150,162],{"class":135},[129,1152,1016],{"class":142},[129,1154,1155],{"class":131,"line":172},[129,1156,293],{"class":142},[21,1158,1159,1162,1163,1166,1167,1169],{},[112,1160,1161],{},"super()"," must be the ",[103,1164,1165],{},"first statement"," in the subclass constructor. If you don't write it explicitly, Java inserts an invisible ",[112,1168,1161],{}," for you. That's why this:",[120,1171,1173],{"className":122,"code":1172,"language":124,"meta":125,"style":125},"public A() {\n}\n",[112,1174,1175,1184],{"__ignoreMap":125},[129,1176,1177,1179,1182],{"class":131,"line":132},[129,1178,703],{"class":135},[129,1180,1181],{"class":138}," A",[129,1183,190],{"class":142},[129,1185,1186],{"class":131,"line":146},[129,1187,293],{"class":142},[21,1189,1190],{},"is actually equivalent to:",[120,1192,1194],{"className":122,"code":1193,"language":124,"meta":125,"style":125},"public A() {\n    super();\n}\n",[112,1195,1196,1204,1210],{"__ignoreMap":125},[129,1197,1198,1200,1202],{"class":131,"line":132},[129,1199,703],{"class":135},[129,1201,1181],{"class":138},[129,1203,190],{"class":142},[129,1205,1206,1208],{"class":131,"line":146},[129,1207,1134],{"class":165},[129,1209,407],{"class":142},[129,1211,1212],{"class":131,"line":153},[129,1213,293],{"class":142},[21,1215,1216,1219,1220,1223,1224,1226],{},[25,1217,1218],{},"Watch out:"," if your superclass only has a constructor that takes arguments (no no-arg constructor), and your subclass constructor doesn't explicitly call ",[112,1221,1222],{},"super(...)"," with the right arguments, you'll get a compile error. The compiler tries to insert ",[112,1225,1161],{}," and finds nothing matching.",[16,1228,1230],{"id":1229},"overriding-vs-overloading","Overriding vs. Overloading",[21,1232,1233],{},"These two words sound similar and trip up everyone at first.",[21,1235,1236,1239,1240,1243],{},[25,1237,1238],{},"Overloading"," — defining multiple methods with the ",[25,1241,1242],{},"same name but different parameter lists"," in the same class (or across an inheritance chain).",[120,1245,1247],{"className":122,"code":1246,"language":124,"meta":125,"style":125},"class Calculator {\n    int add(int a, int b)          { return a + b; }\n    double add(double a, double b) { return a + b; }   \u002F\u002F overload\n}\n",[112,1248,1249,1258,1295,1328],{"__ignoreMap":125},[129,1250,1251,1253,1256],{"class":131,"line":132},[129,1252,77],{"class":135},[129,1254,1255],{"class":138}," Calculator",[129,1257,143],{"class":142},[129,1259,1260,1263,1266,1268,1270,1273,1275,1277,1280,1283,1286,1289,1292],{"class":131,"line":146},[129,1261,1262],{"class":135},"    int",[129,1264,1265],{"class":138}," add",[129,1267,215],{"class":142},[129,1269,541],{"class":135},[129,1271,1272],{"class":221}," a",[129,1274,926],{"class":142},[129,1276,541],{"class":135},[129,1278,1279],{"class":221}," b",[129,1281,1282],{"class":142},")          { ",[129,1284,1285],{"class":135},"return",[129,1287,1288],{"class":142}," a ",[129,1290,1291],{"class":135},"+",[129,1293,1294],{"class":142}," b; }\n",[129,1296,1297,1299,1301,1303,1305,1307,1309,1311,1313,1316,1318,1320,1322,1325],{"class":131,"line":153},[129,1298,156],{"class":135},[129,1300,1265],{"class":138},[129,1302,215],{"class":142},[129,1304,218],{"class":135},[129,1306,1272],{"class":221},[129,1308,926],{"class":142},[129,1310,218],{"class":135},[129,1312,1279],{"class":221},[129,1314,1315],{"class":142},") { ",[129,1317,1285],{"class":135},[129,1319,1288],{"class":142},[129,1321,1291],{"class":135},[129,1323,1324],{"class":142}," b; }   ",[129,1326,1327],{"class":149},"\u002F\u002F overload\n",[129,1329,1330],{"class":131,"line":172},[129,1331,293],{"class":142},[21,1333,1334,1337,1338,1341,1342,1345],{},[25,1335,1336],{},"Overriding"," — a subclass provides a ",[25,1339,1340],{},"new implementation"," of a method that already exists in the superclass. Same name, ",[25,1343,1344],{},"same parameter list",", same return type.",[120,1347,1349],{"className":122,"code":1348,"language":124,"meta":125,"style":125},"class Animal {\n    public String sound() { return \"Some sound\"; }\n}\n \nclass Dog extends Animal {\n    @Override\n    public String sound() { return \"Woof\"; }   \u002F\u002F override\n}\n",[112,1350,1351,1360,1381,1385,1389,1402,1410,1431],{"__ignoreMap":125},[129,1352,1353,1355,1358],{"class":131,"line":132},[129,1354,77],{"class":135},[129,1356,1357],{"class":138}," Animal",[129,1359,143],{"class":142},[129,1361,1362,1364,1367,1370,1373,1375,1378],{"class":131,"line":146},[129,1363,771],{"class":135},[129,1365,1366],{"class":142}," String ",[129,1368,1369],{"class":138},"sound",[129,1371,1372],{"class":142},"() { ",[129,1374,1285],{"class":135},[129,1376,1377],{"class":968}," \"Some sound\"",[129,1379,1380],{"class":142},"; }\n",[129,1382,1383],{"class":131,"line":153},[129,1384,293],{"class":142},[129,1386,1387],{"class":131,"line":172},[129,1388,175],{"class":142},[129,1390,1391,1393,1396,1398,1400],{"class":131,"line":178},[129,1392,77],{"class":135},[129,1394,1395],{"class":138}," Dog",[129,1397,1003],{"class":135},[129,1399,1357],{"class":138},[129,1401,143],{"class":142},[129,1403,1404,1407],{"class":131,"line":184},[129,1405,1406],{"class":142},"    @",[129,1408,1409],{"class":135},"Override\n",[129,1411,1412,1414,1416,1418,1420,1422,1425,1428],{"class":131,"line":193},[129,1413,771],{"class":135},[129,1415,1366],{"class":142},[129,1417,1369],{"class":138},[129,1419,1372],{"class":142},[129,1421,1285],{"class":135},[129,1423,1424],{"class":968}," \"Woof\"",[129,1426,1427],{"class":142},"; }   ",[129,1429,1430],{"class":149},"\u002F\u002F override\n",[129,1432,1433],{"class":131,"line":199},[129,1434,293],{"class":142},[21,1436,1437,1438,1441,1442,332],{},"The ",[112,1439,1440],{},"@Override"," annotation isn't strictly required, but it's a good habit — the compiler will check that you really are overriding something, catching typos like ",[112,1443,1444],{},"sond()",[16,1446,1448],{"id":1447},"polymorphism","Polymorphism",[21,1450,1451,1452,1454,1455,1458,1459,332],{},"Here's where it gets interesting. ",[25,1453,1448],{}," is the feature that lets a variable of a ",[103,1456,1457],{},"supertype"," refer to an object of a ",[103,1460,1461],{},"subtype",[120,1463,1465],{"className":122,"code":1464,"language":124,"meta":125,"style":125},"GeometricObject geoObj = new Circle();   \u002F\u002F legal!\nFruit f = new Apple();                    \u002F\u002F also legal\n",[112,1466,1467,1484],{"__ignoreMap":125},[129,1468,1469,1472,1474,1476,1478,1481],{"class":131,"line":132},[129,1470,1471],{"class":142},"GeometricObject geoObj ",[129,1473,162],{"class":135},[129,1475,401],{"class":135},[129,1477,139],{"class":138},[129,1479,1480],{"class":142},"();   ",[129,1482,1483],{"class":149},"\u002F\u002F legal!\n",[129,1485,1486,1489,1491,1493,1496,1499],{"class":131,"line":146},[129,1487,1488],{"class":142},"Fruit f ",[129,1490,162],{"class":135},[129,1492,401],{"class":135},[129,1494,1495],{"class":138}," Apple",[129,1497,1498],{"class":142},"();                    ",[129,1500,1501],{"class":149},"\u002F\u002F also legal\n",[21,1503,1504,1505,1508,1509,1511,1512,1515,1516,1518,1519,934,1521,934,1524,332],{},"The variable's ",[103,1506,1507],{},"declared type"," is ",[112,1510,922],{},", but the ",[103,1513,1514],{},"actual object"," it points to is a ",[112,1517,114],{},". This is fine because every ",[112,1520,114],{},[103,1522,1523],{},"is a",[112,1525,922],{},[16,1527,1529],{"id":1528},"dynamic-binding","Dynamic binding",[21,1531,1532,1533,1536,1537,1539,1540,1542],{},"So if we call ",[112,1534,1535],{},"geoObj.toString()",", which method actually runs — the one in ",[112,1538,922],{}," or the one in ",[112,1541,114],{},"?",[21,1544,1545,934,1548,1552,1553,1556,1557,332],{},[25,1546,1547],{},"The one in",[25,1549,1550,332],{},[112,1551,114],{}," Java looks at the ",[103,1554,1555],{},"actual object's type"," at runtime, not the declared variable type, and picks the most specific version of the method. This is called ",[25,1558,1559],{},"dynamic binding",[21,1561,1562],{},"Example:",[120,1564,1566],{"className":122,"code":1565,"language":124,"meta":125,"style":125},"public class PolymorphismDemo {\n    public static void main(String[] args) {\n        m(new GraduateStudent());\n        m(new Student());\n        m(new Person());\n        m(new Object());\n    }\n \n    public static void m(Object x) {\n        System.out.println(x.toString());\n    }\n}\n \nclass GraduateStudent extends Student { }\n \nclass Student extends Person {\n    public String toString() { return \"Student\"; }\n}\n \nclass Person extends Object {\n    public String toString() { return \"Person\"; }\n}\n",[112,1567,1568,1579,1605,1620,1633,1646,1659,1663,1667,1686,1702,1706,1710,1714,1727,1731,1743,1760,1764,1769,1782,1800],{"__ignoreMap":125},[129,1569,1570,1572,1574,1577],{"class":131,"line":132},[129,1571,703],{"class":135},[129,1573,115],{"class":135},[129,1575,1576],{"class":138}," PolymorphismDemo",[129,1578,143],{"class":142},[129,1580,1581,1583,1586,1589,1592,1594,1597,1600,1603],{"class":131,"line":146},[129,1582,771],{"class":135},[129,1584,1585],{"class":135}," static",[129,1587,1588],{"class":135}," void",[129,1590,1591],{"class":138}," main",[129,1593,215],{"class":142},[129,1595,1596],{"class":135},"String",[129,1598,1599],{"class":142},"[] ",[129,1601,1602],{"class":221},"args",[129,1604,225],{"class":142},[129,1606,1607,1610,1612,1614,1617],{"class":131,"line":153},[129,1608,1609],{"class":138},"        m",[129,1611,215],{"class":142},[129,1613,370],{"class":135},[129,1615,1616],{"class":138}," GraduateStudent",[129,1618,1619],{"class":142},"());\n",[129,1621,1622,1624,1626,1628,1631],{"class":131,"line":172},[129,1623,1609],{"class":138},[129,1625,215],{"class":142},[129,1627,370],{"class":135},[129,1629,1630],{"class":138}," Student",[129,1632,1619],{"class":142},[129,1634,1635,1637,1639,1641,1644],{"class":131,"line":178},[129,1636,1609],{"class":138},[129,1638,215],{"class":142},[129,1640,370],{"class":135},[129,1642,1643],{"class":138}," Person",[129,1645,1619],{"class":142},[129,1647,1648,1650,1652,1654,1657],{"class":131,"line":184},[129,1649,1609],{"class":138},[129,1651,215],{"class":142},[129,1653,370],{"class":135},[129,1655,1656],{"class":138}," Object",[129,1658,1619],{"class":142},[129,1660,1661],{"class":131,"line":193},[129,1662,196],{"class":142},[129,1664,1665],{"class":131,"line":199},[129,1666,175],{"class":142},[129,1668,1669,1671,1673,1675,1678,1681,1684],{"class":131,"line":204},[129,1670,771],{"class":135},[129,1672,1585],{"class":135},[129,1674,1588],{"class":135},[129,1676,1677],{"class":138}," m",[129,1679,1680],{"class":142},"(Object ",[129,1682,1683],{"class":221},"x",[129,1685,225],{"class":142},[129,1687,1688,1691,1694,1697,1700],{"class":131,"line":210},[129,1689,1690],{"class":142},"        System.out.",[129,1692,1693],{"class":138},"println",[129,1695,1696],{"class":142},"(x.",[129,1698,1699],{"class":138},"toString",[129,1701,1619],{"class":142},[129,1703,1704],{"class":131,"line":228},[129,1705,196],{"class":142},[129,1707,1708],{"class":131,"line":239},[129,1709,293],{"class":142},[129,1711,1712],{"class":131,"line":244},[129,1713,175],{"class":142},[129,1715,1716,1718,1720,1722,1724],{"class":131,"line":249},[129,1717,77],{"class":135},[129,1719,1616],{"class":138},[129,1721,1003],{"class":135},[129,1723,1630],{"class":138},[129,1725,1726],{"class":142}," { }\n",[129,1728,1729],{"class":131,"line":255},[129,1730,175],{"class":142},[129,1732,1733,1735,1737,1739,1741],{"class":131,"line":265},[129,1734,77],{"class":135},[129,1736,1630],{"class":138},[129,1738,1003],{"class":135},[129,1740,1643],{"class":138},[129,1742,143],{"class":142},[129,1744,1745,1747,1749,1751,1753,1755,1758],{"class":131,"line":285},[129,1746,771],{"class":135},[129,1748,1366],{"class":142},[129,1750,1699],{"class":138},[129,1752,1372],{"class":142},[129,1754,1285],{"class":135},[129,1756,1757],{"class":968}," \"Student\"",[129,1759,1380],{"class":142},[129,1761,1762],{"class":131,"line":290},[129,1763,293],{"class":142},[129,1765,1767],{"class":131,"line":1766},19,[129,1768,175],{"class":142},[129,1770,1772,1774,1776,1778,1780],{"class":131,"line":1771},20,[129,1773,77],{"class":135},[129,1775,1643],{"class":138},[129,1777,1003],{"class":135},[129,1779,1656],{"class":138},[129,1781,143],{"class":142},[129,1783,1785,1787,1789,1791,1793,1795,1798],{"class":131,"line":1784},21,[129,1786,771],{"class":135},[129,1788,1366],{"class":142},[129,1790,1699],{"class":138},[129,1792,1372],{"class":142},[129,1794,1285],{"class":135},[129,1796,1797],{"class":968}," \"Person\"",[129,1799,1380],{"class":142},[129,1801,1803],{"class":131,"line":1802},22,[129,1804,293],{"class":142},[21,1806,1807],{},"Output:",[120,1809,1812],{"className":1810,"code":1811,"language":897},[895],"Student\nStudent\nPerson\njava.lang.Object@39274\n",[112,1813,1811],{"__ignoreMap":125},[21,1815,1816,1817,1820,1821,1824,1825,1828,1829,1831,1832,1835],{},"Notice that even though the method signature says ",[112,1818,1819],{},"m(Object x)",", the ",[112,1822,1823],{},"toString()"," that runs depends on the actual object passed in. ",[112,1826,1827],{},"GraduateStudent"," doesn't define ",[112,1830,1823],{}," itself, so Java walks up the inheritance chain and finds ",[112,1833,1834],{},"Student","'s version. That's dynamic binding in action.",[21,1837,1838,1839,1842,1843,934,1845,1848],{},"This makes code wonderfully generic — ",[112,1840,1841],{},"m"," works for ",[103,1844,378],{},[112,1846,1847],{},"Object",", but does the right thing for each subtype.",[16,1850,1852],{"id":1851},"the-full-visibility-modifier-table","The full visibility modifier table",[21,1854,1855,1856,324,1858,1860],{},"I mentioned ",[112,1857,703],{},[112,1859,707],{}," earlier. There are actually four levels in Java:",[1862,1863,1864,1886],"table",{},[1865,1866,1867],"thead",{},[1868,1869,1870,1874,1877,1880,1883],"tr",{},[1871,1872,1873],"th",{},"Modifier",[1871,1875,1876],{},"Same class",[1871,1878,1879],{},"Same package",[1871,1881,1882],{},"Subclass",[1871,1884,1885],{},"Different package",[1887,1888,1889,1905,1921,1934],"tbody",{},[1868,1890,1891,1896,1899,1901,1903],{},[1892,1893,1894],"td",{},[112,1895,703],{},[1892,1897,1898],{},"✓",[1892,1900,1898],{},[1892,1902,1898],{},[1892,1904,1898],{},[1868,1906,1907,1912,1914,1916,1918],{},[1892,1908,1909],{},[112,1910,1911],{},"protected",[1892,1913,1898],{},[1892,1915,1898],{},[1892,1917,1898],{},[1892,1919,1920],{},"✗",[1868,1922,1923,1926,1928,1930,1932],{},[1892,1924,1925],{},"(default)",[1892,1927,1898],{},[1892,1929,1898],{},[1892,1931,1920],{},[1892,1933,1920],{},[1868,1935,1936,1940,1942,1944,1946],{},[1892,1937,1938],{},[112,1939,707],{},[1892,1941,1898],{},[1892,1943,1920],{},[1892,1945,1920],{},[1892,1947,1920],{},[21,1949,1950,1954,1955,1958],{},[25,1951,1952],{},[112,1953,1911],{}," is the new one. It's like the default, but it ",[103,1956,1957],{},"also"," lets subclasses see the member, even if the subclass is in a different package. It's the right choice when you want to share something with subclasses but keep it hidden from the wider world.",[11,1960,1962],{"id":1961},"part-4-abstract-classes-and-interfaces","Part 4: Abstract Classes and Interfaces",[16,1964,1966],{"id":1965},"why-abstract","Why abstract?",[21,1968,1969,1970,1973,1974,1976,1977,1979,1980,1982,1983,1985],{},"Sometimes you want a superclass that exists ",[103,1971,1972],{},"only"," to be inherited from — never to be instantiated directly. Think of ",[112,1975,922],{},". The very idea of a \"generic geometric object with no specific shape\" doesn't really make sense as a thing you'd create. A ",[112,1978,114],{}," makes sense. A ",[112,1981,929],{}," makes sense. But a plain ",[112,1984,922],{},"? Not so much.",[21,1987,1988,1989,1992],{},"That's where the ",[112,1990,1991],{},"abstract"," keyword comes in.",[16,1994,1996],{"id":1995},"abstract-classes-and-abstract-methods","Abstract classes and abstract methods",[21,1998,1999,2000,2003,2004,2007,2008,2010],{},"An ",[25,2001,2002],{},"abstract method"," is a method declared without a body. It's a promise: \"every concrete subclass must provide this.\" An ",[25,2005,2006],{},"abstract class"," is a class that's marked ",[112,2009,1991],{},", and may contain abstract methods.",[120,2012,2014],{"className":122,"code":2013,"language":124,"meta":125,"style":125},"public abstract class GeometricObject {\n    private String color;\n    \u002F\u002F ...fields and concrete methods...\n \n    public abstract double getArea();        \u002F\u002F no body!\n    public abstract double getPerimeter();   \u002F\u002F no body!\n}\n",[112,2015,2016,2029,2036,2041,2045,2061,2076],{"__ignoreMap":125},[129,2017,2018,2020,2023,2025,2027],{"class":131,"line":132},[129,2019,703],{"class":135},[129,2021,2022],{"class":135}," abstract",[129,2024,115],{"class":135},[129,2026,954],{"class":138},[129,2028,143],{"class":142},[129,2030,2031,2033],{"class":131,"line":146},[129,2032,753],{"class":135},[129,2034,2035],{"class":142}," String color;\n",[129,2037,2038],{"class":131,"line":153},[129,2039,2040],{"class":149},"    \u002F\u002F ...fields and concrete methods...\n",[129,2042,2043],{"class":131,"line":172},[129,2044,175],{"class":142},[129,2046,2047,2049,2051,2053,2055,2058],{"class":131,"line":178},[129,2048,771],{"class":135},[129,2050,2022],{"class":135},[129,2052,756],{"class":135},[129,2054,260],{"class":138},[129,2056,2057],{"class":142},"();        ",[129,2059,2060],{"class":149},"\u002F\u002F no body!\n",[129,2062,2063,2065,2067,2069,2072,2074],{"class":131,"line":184},[129,2064,771],{"class":135},[129,2066,2022],{"class":135},[129,2068,756],{"class":135},[129,2070,2071],{"class":138}," getPerimeter",[129,2073,1480],{"class":142},[129,2075,2060],{"class":149},[129,2077,2078],{"class":131,"line":193},[129,2079,293],{"class":142},[21,2081,2082,2083,332],{},"In UML diagrams, abstract classes and abstract methods are written in ",[103,2084,2085],{},"italics",[16,2087,2089],{"id":2088},"six-rules-about-abstract-classes-the-gotchas","Six rules about abstract classes (the gotchas)",[347,2091,2092,2105,2146,2155,2167,2173],{},[36,2093,2094,2097,2098,2100,2101,2104],{},[25,2095,2096],{},"An abstract method cannot exist in a non-abstract class."," If you have even one abstract method, the class itself must be declared ",[112,2099,1991],{},". And if a subclass of an abstract class doesn't implement ",[103,2102,2103],{},"all"," the inherited abstract methods, that subclass must also be declared abstract.",[36,2106,2107,2110,2111,332,2113,2135,2138,2139,2142,2143,2145],{},[25,2108,2109],{},"You cannot instantiate an abstract class"," with ",[112,2112,370],{},[120,2114,2116],{"className":122,"code":2115,"language":124,"meta":125,"style":125},"GeometricObject g = new GeometricObject();  \u002F\u002F ❌ compile error\n",[112,2117,2118],{"__ignoreMap":125},[129,2119,2120,2123,2125,2127,2129,2132],{"class":131,"line":132},[129,2121,2122],{"class":142},"GeometricObject g ",[129,2124,162],{"class":135},[129,2126,401],{"class":135},[129,2128,954],{"class":138},[129,2130,2131],{"class":142},"();  ",[129,2133,2134],{"class":149},"\u002F\u002F ❌ compile error\n",[2136,2137],"br",{},"But you ",[103,2140,2141],{},"can"," still define constructors for it — they get invoked when subclasses are constructed (via the ",[112,2144,1161],{}," chain).",[36,2147,2148,2151,2152,2154],{},[25,2149,2150],{},"An abstract class doesn't need to have any abstract methods."," It can be 100% concrete methods and still be marked ",[112,2153,1991],{},". The point is just to prevent instantiation — typically because the class is meant only as a base for other classes.",[36,2156,2157,2160,2161,2163,2164,2166],{},[25,2158,2159],{},"A superclass of an abstract class may be concrete."," For example, ",[112,2162,1847],{}," (the root of all Java classes) is concrete, but a class like ",[112,2165,922],{}," that extends it can still be abstract.",[36,2168,2169,2172],{},[25,2170,2171],{},"A concrete method can be overridden as abstract."," Rare, but useful when an inherited implementation no longer makes sense for a subclass. The subclass would then have to be declared abstract.",[36,2174,2175,2178,2179,2243,2245],{},[25,2176,2177],{},"An abstract class can be used as a data type."," You can't create instances of it directly, but you can declare variables and arrays of that type, then store subclass instances:",[120,2180,2182],{"className":122,"code":2181,"language":124,"meta":125,"style":125},"GeometricObject[] shapes = new GeometricObject[10];\nshapes[0] = new Circle();\nshapes[1] = new Rectangle();\n",[112,2183,2184,2206,2225],{"__ignoreMap":125},[129,2185,2186,2188,2191,2193,2195,2197,2200,2203],{"class":131,"line":132},[129,2187,922],{"class":135},[129,2189,2190],{"class":142},"[] shapes ",[129,2192,162],{"class":135},[129,2194,401],{"class":135},[129,2196,954],{"class":135},[129,2198,2199],{"class":142},"[",[129,2201,2202],{"class":165},"10",[129,2204,2205],{"class":142},"];\n",[129,2207,2208,2211,2214,2217,2219,2221,2223],{"class":131,"line":146},[129,2209,2210],{"class":142},"shapes[",[129,2212,2213],{"class":165},"0",[129,2215,2216],{"class":142},"] ",[129,2218,162],{"class":135},[129,2220,401],{"class":135},[129,2222,139],{"class":138},[129,2224,407],{"class":142},[129,2226,2227,2229,2232,2234,2236,2238,2241],{"class":131,"line":153},[129,2228,2210],{"class":142},[129,2230,2231],{"class":165},"1",[129,2233,2216],{"class":142},[129,2235,162],{"class":135},[129,2237,401],{"class":135},[129,2239,2240],{"class":138}," Rectangle",[129,2242,407],{"class":142},[2136,2244],{},"This is polymorphism at work.",[16,2247,2249],{"id":2248},"interfaces","Interfaces",[21,2251,1999,2252,2255,2256,2259],{},[25,2253,2254],{},"interface"," is a class-like construct that contains ",[25,2257,2258],{},"only constants and abstract methods"," — no real implementation, no constructors, no state. (Modern Java has loosened this slightly with default methods, but the original spirit is what matters.)",[21,2261,2262,2263,2266,2267,926,2270,926,2273,2276,2277,2280,2281,2284,2285,332],{},"The intent of an interface is to specify ",[25,2264,2265],{},"common behavior"," that classes from totally different parts of the hierarchy might share. For example, ",[112,2268,2269],{},"Comparable",[112,2271,2272],{},"Edible",[112,2274,2275],{},"Cloneable",". A ",[112,2278,2279],{},"Chicken"," and a ",[112,2282,2283],{},"Fruit"," don't share a common animal-or-plant superclass, but both can be ",[112,2286,2272],{},[16,2288,2290],{"id":2289},"defining-an-interface","Defining an interface",[120,2292,2294],{"className":122,"code":2293,"language":124,"meta":125,"style":125},"public interface Edible {\n    \u002F** Describe how to eat *\u002F\n    public abstract String howToEat();\n}\n",[112,2295,2296,2308,2313,2326],{"__ignoreMap":125},[129,2297,2298,2300,2303,2306],{"class":131,"line":132},[129,2299,703],{"class":135},[129,2301,2302],{"class":135}," interface",[129,2304,2305],{"class":138}," Edible",[129,2307,143],{"class":142},[129,2309,2310],{"class":131,"line":146},[129,2311,2312],{"class":149},"    \u002F** Describe how to eat *\u002F\n",[129,2314,2315,2317,2319,2321,2324],{"class":131,"line":153},[129,2316,771],{"class":135},[129,2318,2022],{"class":135},[129,2320,1366],{"class":142},[129,2322,2323],{"class":138},"howToEat",[129,2325,407],{"class":142},[129,2327,2328],{"class":131,"line":172},[129,2329,293],{"class":142},[21,2331,2332,2333,2336],{},"A class signs the contract using the ",[112,2334,2335],{},"implements"," keyword:",[120,2338,2340],{"className":122,"code":2339,"language":124,"meta":125,"style":125},"class Apple extends Fruit implements Edible {\n    @Override\n    public String howToEat() {\n        return \"Apple: Make apple cider\";\n    }\n}\n",[112,2341,2342,2360,2366,2376,2385,2389],{"__ignoreMap":125},[129,2343,2344,2346,2348,2350,2353,2356,2358],{"class":131,"line":132},[129,2345,77],{"class":135},[129,2347,1495],{"class":138},[129,2349,1003],{"class":135},[129,2351,2352],{"class":138}," Fruit",[129,2354,2355],{"class":135}," implements",[129,2357,2305],{"class":138},[129,2359,143],{"class":142},[129,2361,2362,2364],{"class":131,"line":146},[129,2363,1406],{"class":142},[129,2365,1409],{"class":135},[129,2367,2368,2370,2372,2374],{"class":131,"line":153},[129,2369,771],{"class":135},[129,2371,1366],{"class":142},[129,2373,2323],{"class":138},[129,2375,190],{"class":142},[129,2377,2378,2380,2383],{"class":131,"line":172},[129,2379,268],{"class":135},[129,2381,2382],{"class":968}," \"Apple: Make apple cider\"",[129,2384,169],{"class":142},[129,2386,2387],{"class":131,"line":178},[129,2388,196],{"class":142},[129,2390,2391],{"class":131,"line":184},[129,2392,293],{"class":142},[21,2394,2395,2396,2398,2399,2402],{},"Any class that ",[112,2397,2335],{}," an interface must provide an implementation for ",[25,2400,2401],{},"every"," method in that interface — or it must itself be declared abstract.",[16,2404,2406],{"id":2405},"extends-vs-implements-the-key-rules","Extends vs. implements — the key rules",[21,2408,2409],{},"This trips a lot of people up:",[33,2411,2412,2421,2429,2436],{},[36,2413,2414,2415,934,2417,2420],{},"A class can ",[112,2416,1042],{},[25,2418,2419],{},"at most one"," class (single inheritance).",[36,2422,2414,2423,934,2425,2428],{},[112,2424,2335],{},[25,2426,2427],{},"any number"," of interfaces (multiple).",[36,2430,2431,2432,934,2434,2428],{},"An interface can ",[112,2433,1042],{},[25,2435,2427],{},[36,2437,2438,2439,934,2442,2444],{},"An interface ",[25,2440,2441],{},"cannot",[112,2443,2335],{}," an interface.\nPutting it together:",[120,2446,2448],{"className":122,"code":2447,"language":124,"meta":125,"style":125},"public class NewClass extends BaseClass\n        implements Interface1, Interface2, InterfaceN {\n    \u002F\u002F ...\n}\n",[112,2449,2450,2464,2484,2489],{"__ignoreMap":125},[129,2451,2452,2454,2456,2459,2461],{"class":131,"line":132},[129,2453,703],{"class":135},[129,2455,115],{"class":135},[129,2457,2458],{"class":138}," NewClass",[129,2460,1003],{"class":135},[129,2462,2463],{"class":138}," BaseClass\n",[129,2465,2466,2469,2472,2474,2477,2479,2482],{"class":131,"line":146},[129,2467,2468],{"class":135},"        implements",[129,2470,2471],{"class":138}," Interface1",[129,2473,926],{"class":142},[129,2475,2476],{"class":138},"Interface2",[129,2478,926],{"class":142},[129,2480,2481],{"class":138},"InterfaceN",[129,2483,143],{"class":142},[129,2485,2486],{"class":131,"line":153},[129,2487,2488],{"class":149},"    \u002F\u002F ...\n",[129,2490,2491],{"class":131,"line":172},[129,2492,293],{"class":142},[21,2494,2495],{},"And for interfaces extending other interfaces:",[120,2497,2499],{"className":122,"code":2498,"language":124,"meta":125,"style":125},"public interface NewInterface extends Interface1, Interface2 {\n    \u002F\u002F constants and abstract methods\n}\n",[112,2500,2501,2520,2525],{"__ignoreMap":125},[129,2502,2503,2505,2507,2510,2512,2514,2516,2518],{"class":131,"line":132},[129,2504,703],{"class":135},[129,2506,2302],{"class":135},[129,2508,2509],{"class":138}," NewInterface",[129,2511,1003],{"class":135},[129,2513,2471],{"class":138},[129,2515,926],{"class":142},[129,2517,2476],{"class":138},[129,2519,143],{"class":142},[129,2521,2522],{"class":131,"line":146},[129,2523,2524],{"class":149},"    \u002F\u002F constants and abstract methods\n",[129,2526,2527],{"class":131,"line":153},[129,2528,293],{"class":142},[16,2530,2532],{"id":2531},"omitting-modifiers-in-interfaces","Omitting modifiers in interfaces",[21,2534,2535,2536,2538,2539,2542,2543,2545,2546,2549],{},"In an interface, ",[25,2537,2401],{}," field is implicitly ",[112,2540,2541],{},"public static final"," (i.e., a constant), and ",[25,2544,2401],{}," method is implicitly ",[112,2547,2548],{},"public abstract",". So you can leave those modifiers off:",[120,2551,2553],{"className":122,"code":2552,"language":124,"meta":125,"style":125},"public interface T1 {\n    public static final int K = 1;\n    public abstract void p();\n}\n \n\u002F\u002F is exactly equivalent to:\n \npublic interface T1 {\n    int K = 1;\n    void p();\n}\n",[112,2554,2555,2566,2587,2600,2604,2608,2613,2617,2627,2639,2648],{"__ignoreMap":125},[129,2556,2557,2559,2561,2564],{"class":131,"line":132},[129,2558,703],{"class":135},[129,2560,2302],{"class":135},[129,2562,2563],{"class":138}," T1",[129,2565,143],{"class":142},[129,2567,2568,2570,2572,2575,2578,2581,2583,2585],{"class":131,"line":146},[129,2569,771],{"class":135},[129,2571,1585],{"class":135},[129,2573,2574],{"class":135}," final",[129,2576,2577],{"class":135}," int",[129,2579,2580],{"class":142}," K ",[129,2582,162],{"class":135},[129,2584,549],{"class":165},[129,2586,169],{"class":142},[129,2588,2589,2591,2593,2595,2598],{"class":131,"line":153},[129,2590,771],{"class":135},[129,2592,2022],{"class":135},[129,2594,1588],{"class":135},[129,2596,2597],{"class":138}," p",[129,2599,407],{"class":142},[129,2601,2602],{"class":131,"line":172},[129,2603,293],{"class":142},[129,2605,2606],{"class":131,"line":178},[129,2607,175],{"class":142},[129,2609,2610],{"class":131,"line":184},[129,2611,2612],{"class":149},"\u002F\u002F is exactly equivalent to:\n",[129,2614,2615],{"class":131,"line":193},[129,2616,175],{"class":142},[129,2618,2619,2621,2623,2625],{"class":131,"line":199},[129,2620,703],{"class":135},[129,2622,2302],{"class":135},[129,2624,2563],{"class":138},[129,2626,143],{"class":142},[129,2628,2629,2631,2633,2635,2637],{"class":131,"line":204},[129,2630,1262],{"class":135},[129,2632,2580],{"class":142},[129,2634,162],{"class":135},[129,2636,549],{"class":165},[129,2638,169],{"class":142},[129,2640,2641,2644,2646],{"class":131,"line":210},[129,2642,2643],{"class":135},"    void",[129,2645,2597],{"class":138},[129,2647,407],{"class":142},[129,2649,2650],{"class":131,"line":228},[129,2651,293],{"class":142},[21,2653,2654,2655,332],{},"You access an interface's constant via the interface name: ",[112,2656,2657],{},"T1.K",[16,2659,2661],{"id":2660},"interface-vs-abstract-class-when-to-use-which","Interface vs. Abstract Class — when to use which?",[1862,2663,2664,2682],{},[1865,2665,2666],{},[1868,2667,2668,2672,2677],{},[1871,2669,2670],{},[2136,2671],{},[1871,2673,2674],{},[25,2675,2676],{},"Abstract Class",[1871,2678,2679],{},[25,2680,2681],{},"Interface",[1887,2683,2684,2698,2713,2726],{},[1868,2685,2686,2689,2692],{},[1892,2687,2688],{},"Variables",[1892,2690,2691],{},"No restrictions",[1892,2693,2694,2695,2697],{},"Must be ",[112,2696,2541],{}," (constants only)",[1868,2699,2700,2702,2710],{},[1892,2701,335],{},[1892,2703,2704,2705,2707,2708,332],{},"Yes (called by subclasses via ",[112,2706,1161],{},"). Cannot instantiate with ",[112,2709,370],{},[1892,2711,2712],{},"No constructors. Cannot instantiate.",[1868,2714,2715,2718,2721],{},[1892,2716,2717],{},"Methods",[1892,2719,2720],{},"No restrictions (abstract or concrete)",[1892,2722,2723,2724],{},"All methods are implicitly ",[112,2725,2548],{},[1868,2727,2728,2730,2736],{},[1892,2729,918],{},[1892,2731,2732,2733,2735],{},"A class can extend ",[25,2734,1083],{}," abstract class",[1892,2737,2738,2739,2742],{},"A class can implement ",[25,2740,2741],{},"many"," interfaces",[21,2744,2745],{},"A rough rule of thumb:",[33,2747,2748,2757],{},[36,2749,2750,2753,2754,2756],{},[25,2751,2752],{},"Use an abstract class"," when subclasses share a common identity and a chunk of common implementation (e.g., all kinds of ",[112,2755,922],{}," share color and filled state).",[36,2758,2759,2762,2763,2766,2767,926,2769,926,2771,2774,2775,2778,2779,332],{},[25,2760,2761],{},"Use an interface"," when classes from different parts of the type hierarchy need to share a ",[103,2764,2765],{},"capability"," (e.g., ",[112,2768,2269],{},[112,2770,2272],{},[112,2772,2773],{},"Runnable","). Interfaces describe what something ",[103,2776,2777],{},"can do",", regardless of what it ",[103,2780,578],{},[11,2782,2784],{"id":2783},"quick-recap-aka-my-cheat-sheet","Quick Recap (a.k.a. my cheat sheet)",[21,2786,2787],{},"A quick reference I'll come back to before exams:",[33,2789,2790,2799,2802,2807,2814,2817,2834,2842,2852,2857,2865,2872,2883,2889,2894],{},[36,2791,2792,2795,2796,2798],{},[25,2793,2794],{},"Class"," = blueprint. ",[25,2797,1847],{}," = instance of a class.",[36,2800,2801],{},"An object has identity, state (fields), and behavior (methods).",[36,2803,2804,2805,332],{},"Constructors share the class name, have no return type, are called with ",[112,2806,370],{},[36,2808,2809,2810,2813],{},"A default no-arg constructor only exists if you write ",[103,2811,2812],{},"no"," constructors yourself.",[36,2815,2816],{},"Object variables hold references, not values. Assigning one to another shares the same object.",[36,2818,2819,2820,2822,2823,2826,2827,2830,2831,332],{},"Make fields ",[112,2821,707],{}," and expose them through ",[112,2824,2825],{},"get","\u002F",[112,2828,2829],{},"set"," methods. This is ",[25,2832,2833],{},"encapsulation",[36,2835,2836,2838,2839,2841],{},[25,2837,918],{}," (",[112,2840,1042],{},") lets a subclass reuse and extend a superclass.",[36,2843,2844,2845,2848,2849,332],{},"Java has ",[25,2846,2847],{},"single inheritance for classes"," but ",[25,2850,2851],{},"multiple inheritance for interfaces",[36,2853,2854,2856],{},[112,2855,1161],{}," calls the parent constructor. It's auto-inserted if you omit it (provided a no-arg parent constructor exists).",[36,2858,2859,2861,2862,2864],{},[25,2860,1238],{}," = same name, different parameters. ",[25,2863,1336],{}," = subclass replaces a parent method (same name, same parameters, same return type).",[36,2866,2867,2869,2870,332],{},[25,2868,1448],{}," lets a supertype variable hold a subtype object. The actual method that runs is decided at runtime — ",[25,2871,1559],{},[36,2873,2874,2875,2877,2878,2880,2881,332],{},"Visibility ladder, most to least open: ",[112,2876,703],{}," > ",[112,2879,1911],{}," > (default) > ",[112,2882,707],{},[36,2884,2885,2888],{},[25,2886,2887],{},"Abstract class"," — cannot be instantiated, may have abstract methods, can have state and constructors.",[36,2890,2891,2893],{},[25,2892,2681],{}," — only constants and abstract method signatures (classically); a pure contract.",[36,2895,2896],{},"Use abstract classes for \"is-a\" with shared implementation. Use interfaces for \"can-do\" capabilities.",[2898,2899],"hr",{},[21,2901,2902],{},"That's the whole OOP foundation. Master these and the rest of Data Structures starts to feel a lot less mysterious — because every data structure we'll meet later (linked lists, stacks, queues, trees) is just a class with thoughtfully chosen fields and methods, often built using inheritance or interfaces.",[2904,2905,2906],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}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);}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}",{"title":125,"searchDepth":146,"depth":146,"links":2908},[2909,2922,2925,2934,2944],{"id":13,"depth":146,"text":14,"children":2910},[2911,2912,2913,2915,2916,2917,2918,2919,2921],{"id":18,"depth":153,"text":19},{"id":70,"depth":153,"text":71},{"id":109,"depth":153,"text":2914},"A first example: the Circle class",{"id":331,"depth":153,"text":335},{"id":382,"depth":153,"text":383},{"id":490,"depth":153,"text":491},{"id":527,"depth":153,"text":528},{"id":699,"depth":153,"text":2920},"Visibility modifiers: public vs. private",{"id":800,"depth":153,"text":801},{"id":853,"depth":146,"text":854,"children":2923},[2924],{"id":857,"depth":153,"text":858},{"id":905,"depth":146,"text":906,"children":2926},[2927,2928,2929,2930,2931,2932,2933],{"id":909,"depth":153,"text":910},{"id":941,"depth":153,"text":942},{"id":1098,"depth":153,"text":1099},{"id":1229,"depth":153,"text":1230},{"id":1447,"depth":153,"text":1448},{"id":1528,"depth":153,"text":1529},{"id":1851,"depth":153,"text":1852},{"id":1961,"depth":146,"text":1962,"children":2935},[2936,2937,2938,2939,2940,2941,2942,2943],{"id":1965,"depth":153,"text":1966},{"id":1995,"depth":153,"text":1996},{"id":2088,"depth":153,"text":2089},{"id":2248,"depth":153,"text":2249},{"id":2289,"depth":153,"text":2290},{"id":2405,"depth":153,"text":2406},{"id":2531,"depth":153,"text":2532},{"id":2660,"depth":153,"text":2661},{"id":2783,"depth":146,"text":2784},"2026-05-11",false,"md",null,{},true,"\u002Fblog\u002FData-Structure-Concept-Revision",{"title":5,"description":125},{"loc":2951},"blog\u002FData-Structure-Concept-Revision","O07n9DHto-cnoQjzvGL87VHiantvLf4hix0EYQVIajo",111,{"id":2958,"extension":2959,"meta":2960,"series":2961,"stem":3070,"__hash__":3071},"series\u002Fseries.json","json",{},{"微積分教學":2962,"生活紀錄":2965,"Motor Control":2967,"生活隨筆":2981,"Motor learning":2985,"小兒物治":3003,"中風":3018,"平衡":3031,"Network Communication":3041,"CSA":3048,"機器學習":3054,"小腦":3058,"SCI脊髓損傷":3067},[2963,2964],"微積分隨筆-未完成版","2025數學回顧",[2966],"一個漂流到地球的故事",[2968,2969,2970,2971,2972,2973,2974,2975,2976,2977,2978,2979,2980],"控制自己-Be-water-my-friend","控制自己-Be-water-my-friend（二）","控制自己-Be-water-my-friend（三）","控制自己-Be-water-my-friend（四）","控制自己-Be-water-my-friend（五）","進階控制制制制","周圍理論學派（一）反射理論","周圍理論學派（二）階層理論","中樞理論學派（一）CPG","中樞理論學派（二）Motor-Program","模組理論","系統理論","動態模組理論",[2982,2983,2984],"你好，世界。","根本沒人在乎你的部落格","早安-午安-晚安",[2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002],"動作學習（一）介紹","動作學習（二）form-of-learning","動作學習（三）Measurement-of-learning","動作學習（四）理論","動作學習（五）理論-2","動作學習（六）理論-3","動作學習（七）練習方式-1","動作學習（八）練習方式-2","動作學習（九）回饋-1","動作學習（十）回饋-2-擴增性(KR)","動作學習（十一）回饋-3-擴增性(KP)","動作學習（十一）回饋-4-(間隔+物理引導)","動作學習（十二）神經可塑性","動作學習（十二）神經可塑性2","動作學習（十三）臨床應用","動作學習（十四）記憶","動作學習（十五）影響表現的因素",[3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017],"腦性痲痺-CP","CP補充（一）","CP—Rood-&-Bobath","CP—Rood-&-Bobath（二）","Motor-Learning","Motor-Learning小兒（二）","Gait-analysis小兒（一）","Gait-analysis小兒（二）","小兒發展（一）","小兒發展（二）","小兒發展（三）","小兒發展（四）","小兒發展（五）","GMFCS",[3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030],"腦血管病變（CVA）（中風）(一)","CVA（二）","CVA（三）血管症候群-i","CVA（四）血管症候群-(ii)","CVA（四）","CVA（六）","CVA（七）評估-(i)","CVA（八）評估-(ii)","CVA（九）復健—手部-(i)","CVA（十）功能性走路","CVA（十一）功能性走路ii","CVA（十二）輔助用品",[3032,3033,3034,3035,3036,3037,3038,3039,3040],"平衡與前庭失調（一）","Balance（二）前庭覺-(i)","Balance（三）","Balance（四）評估","Balance（五）復健","Balance（六）功能恢復","Balance（七）前庭障礙","Balance（八）檢查","Balance（九）干預",[3042,3043,3044,3045,3046,3047],"Network-Communication,-Chapter-1","Network-Communication,-Chapter-2","Network-Communication,-Chapter-3","Network-Communication-Chapter-4","Network-Communications,-Chapter-5","Network-Communication,-Chapter-6",[3049,3050,3051,3052,3053],"Week-1-—-Introduction-to-Computer-Systems","Computer-Systems-Architecture-Understanding-Performance","A-Top-Level-View-of-Computer-Function-and-Interconnection","The-Memory-Hierarchy-Understanding-Cache-Memory","Internal-Memory-How-Your-Computer-Remembers-Things",[3055,3056,3057],"機器學習導論","資料前處理與迴歸分析","決策樹",[3059,3060,3061,3062,3063,3064,3065,3066],"小腦（一）","小腦（二）","小腦（三）功能","小腦（四）損傷","小腦（五）各功能障礙","小腦（六）評估","小腦（七）評估(ii)","小腦（八）治療",[3068,3069],"脊髓損傷SCI（一）","SCI（二）受傷機制——創傷性（頸椎）","series","r3Uot7P0d_6NPQIxzyjciP2kW_OcCWsb6zMlWEgWDgQ",[3073,3092,3112,3131,3148,3165,3180,3197,3215,3237],{"id":3074,"title":3075,"avatar":3076,"banner":2948,"bio":3077,"body":3078,"description":125,"extension":2947,"meta":3082,"name":3075,"navigation":2950,"path":3083,"seo":3084,"sitemap":3085,"social":3086,"stem":3090,"__hash__":3091},"authors\u002Fauthors\u002Fautomata.md","Automata","\u002Fimages\u002Fuploads\u002Fnier-automata-2b.jpg","一隻吐司天喵，漂浮在銀河星辰中",{"type":8,"value":3079,"toc":3080},[],{"title":125,"searchDepth":146,"depth":146,"links":3081},[],{},"\u002Fauthors\u002Fautomata",{"description":125},{"loc":3083},{"website":3087,"twitter":3088,"github":3089},"https:\u002F\u002Freurl.cc\u002FWOeM29","https:\u002F\u002Freurl.cc\u002FLnvLEy","https:\u002F\u002Fgithub.com\u002FAutomata-0","authors\u002Fautomata","IkVbO2zA7revgYq624iVWpSZQUyMmWa82tw_EbWXViE",{"id":3093,"title":3094,"avatar":3095,"banner":3096,"bio":3097,"body":3098,"description":125,"extension":2947,"meta":3102,"name":3103,"navigation":2950,"path":3104,"seo":3105,"sitemap":3106,"social":3107,"stem":3110,"__hash__":3111},"authors\u002Fauthors\u002Fchinono.md","Chinono","\u002Fimages\u002Fuploads\u002F103467998_p0 copy.png","\u002Fimages\u002Fbackground_light.jpg","我不是女生！",{"type":8,"value":3099,"toc":3100},[],{"title":125,"searchDepth":146,"depth":146,"links":3101},[],{},"七糯糯","\u002Fauthors\u002Fchinono",{"description":125},{"loc":3104},{"github":3108,"twitter":125,"website":3109},"https:\u002F\u002Fgithub.com\u002FChinHongTan","https:\u002F\u002Fchinono.dev","authors\u002Fchinono","jj1J9mFh3InZFL6XtCzGBQ5jPip0EwBDE3mjGvnN6jE",{"id":3113,"title":3114,"avatar":3115,"banner":3116,"bio":3117,"body":3118,"description":125,"extension":2947,"meta":3122,"name":3123,"navigation":2950,"path":3124,"seo":3125,"sitemap":3126,"social":3127,"stem":3129,"__hash__":3130},"authors\u002Fauthors\u002Fhibiki12141132.md","Hibiki12141132","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F265822020?v=4","\u002Fimages\u002Fuploads\u002F1773978423557-___.jpg","享受著知識強姦大腦的過程 (內文含個人發癲 不要再意)",{"type":8,"value":3119,"toc":3120},[],{"title":125,"searchDepth":146,"depth":146,"links":3121},[],{},"HiBiKi","\u002Fauthors\u002Fhibiki12141132",{"description":125},{"loc":3124},{"github":3128,"twitter":125},"https:\u002F\u002Fgithub.com\u002FHiBiKi12141132","authors\u002Fhibiki12141132","dbRnKEcYeCH_faD8R7AUmPPcwgc26s_fR4Q_lu4qtA4",{"id":3132,"title":3133,"avatar":3134,"banner":2948,"bio":3135,"body":3136,"description":125,"extension":2947,"meta":3140,"name":3133,"navigation":2950,"path":3141,"seo":3142,"sitemap":3143,"social":3144,"stem":3146,"__hash__":3147},"authors\u002Fauthors\u002Fmahiro.md","Mahiro","https:\u002F\u002Ftruth.bahamut.com.tw\u002Fs01\u002F202601\u002F2a29b047d341f840b2ce89f7d65b2ba3.JPG","一個致力於逃離新竹的電機系小雜魚",{"type":8,"value":3137,"toc":3138},[],{"title":125,"searchDepth":146,"depth":146,"links":3139},[],{},"\u002Fauthors\u002Fmahiro",{"description":125},{"loc":3141},{"github":3145},"https:\u002F\u002Fgithub.com\u002Fwifekurumi","authors\u002Fmahiro","b435tdWu9eXUf06WroCge0I405cqA0FhLlUUhoPk14k",{"id":3149,"title":3150,"avatar":3151,"banner":2948,"bio":3152,"body":3153,"description":125,"extension":2947,"meta":3157,"name":3150,"navigation":2950,"path":3158,"seo":3159,"sitemap":3160,"social":3161,"stem":3163,"__hash__":3164},"authors\u002Fauthors\u002Fosborrrrn.md","Osborrrrn","\u002Fimages\u002Fuploads\u002Frectangle_large_type_2_c516437ed713e5de1f7d2dca8a20cd81.jpg","別人笑我太瘋癲，我笑他人看不穿。\n不見五陵豪傑墓，無花無酒鋤就田",{"type":8,"value":3154,"toc":3155},[],{"title":125,"searchDepth":146,"depth":146,"links":3156},[],{},"\u002Fauthors\u002Fosborrrrn",{"description":125},{"loc":3158},{"github":3162},"https:\u002F\u002Fgithub.com\u002FOsborrrrn","authors\u002Fosborrrrn","w6VWZKPUwvXn5i7MKXOpU2Jeqr3BrdTKVCeDOF2jZlU",{"id":3166,"title":3167,"avatar":2948,"banner":2948,"bio":3168,"body":3169,"description":125,"extension":2947,"meta":3173,"name":3167,"navigation":2950,"path":3174,"seo":3175,"sitemap":3176,"social":3177,"stem":3178,"__hash__":3179},"authors\u002Fauthors\u002F法法.md","法法","123",{"type":8,"value":3170,"toc":3171},[],{"title":125,"searchDepth":146,"depth":146,"links":3172},[],{},"\u002Fauthors\u002F法法",{"description":125},{"loc":3174},{"github":125},"authors\u002F法法","o5pdVuPCfTmhkDCpvgy4YmAP0CGdvFluPvjhgvQVbsI",{"id":3181,"title":3182,"avatar":3183,"banner":2948,"bio":3184,"body":3185,"description":125,"extension":2947,"meta":3189,"name":3182,"navigation":2950,"path":3190,"seo":3191,"sitemap":3192,"social":3193,"stem":3195,"__hash__":3196},"authors\u002Fauthors\u002F灰海獅.md","灰海獅","\u002Fimages\u002Fuploads\u002Fimg_3279.jpeg","守夜人",{"type":8,"value":3186,"toc":3187},[],{"title":125,"searchDepth":146,"depth":146,"links":3188},[],{},"\u002Fauthors\u002F灰海獅",{"description":125},{"loc":3190},{"github":3194},"https:\u002F\u002Fgithub.com\u002Fyuiri333","authors\u002F灰海獅","iZoSIFbQdS-6v3LiK1txgxnIMKy-d2CyZXQk9CMua_s",{"id":3198,"title":3199,"avatar":3200,"banner":3201,"bio":3202,"body":3203,"description":125,"extension":2947,"meta":3207,"name":3199,"navigation":2950,"path":3208,"seo":3209,"sitemap":3210,"social":3211,"stem":3213,"__hash__":3214},"authors\u002Fauthors\u002F花夜.md","花夜","\u002Fimages\u002Fuploads\u002F1772719470518-791_20260218161129.png","\u002Fimages\u002Fuploads\u002Fimg_2446.png","無論你身在何處，我都會在這裡等你",{"type":8,"value":3204,"toc":3205},[],{"title":125,"searchDepth":146,"depth":146,"links":3206},[],{},"\u002Fauthors\u002F花夜",{"description":125},{"loc":3208},{"github":3212,"twitter":125},"https:\u002F\u002Fgithub.com\u002Fflowernight0709","authors\u002F花夜","a7jeQiF_JkawgYIR-aYSGceJdDP6Z-OWydsICvgSIzs",{"id":3216,"title":3217,"avatar":3218,"banner":3219,"bio":3220,"body":3221,"description":3225,"extension":2947,"meta":3228,"name":3217,"navigation":2950,"path":3229,"seo":3230,"sitemap":3231,"social":3232,"stem":3235,"__hash__":3236},"authors\u002Fauthors\u002F輝月.md","輝月","\u002Fimages\u002Fuploads\u002Ffb_img_1771085634823.jpg","\u002Fimages\u002Fuploads\u002Fimg_1751.jpg","天下布魔好好玩",{"type":8,"value":3222,"toc":3226},[3223],[21,3224,3225],{},"準大學生，目前正在製作TFR模組",{"title":125,"searchDepth":146,"depth":146,"links":3227},[],{},"\u002Fauthors\u002F輝月",{"description":3225},{"loc":3229},{"twitter":3233,"github":3234},"https:\u002F\u002Fx.com\u002Fhuiyue945","https:\u002F\u002Fgithub.com\u002Fhuiyueyea","authors\u002F輝月","koUocBihphDy3453-nAcolM7JJYwI7UMBpVkf1JQrMQ",{"id":3238,"title":3239,"avatar":3240,"banner":2948,"bio":3241,"body":3242,"description":3246,"extension":2947,"meta":3259,"name":3239,"navigation":2950,"path":3260,"seo":3261,"sitemap":3262,"social":3263,"stem":3265,"__hash__":3266},"authors\u002Fauthors\u002F阿西狄亞.md","阿西狄亞","\u002Fimages\u002Fuploads\u002Fimg_20251215_121849_589.jpg","君は実に馬鹿だな",{"type":8,"value":3243,"toc":3257},[3244,3247],[21,3245,3246],{},"我是阿西狄亞，阿西狄亞的阿，阿西狄亞的西，阿西狄亞的狄，阿西狄亞的亞，你可以叫我阿西。",[21,3248,3249,3252,3253,3256],{},[25,3250,3251],{},"我說的所有事情都抱有極度主觀的看法以及意見","，如果你有其他想法，",[25,3254,3255],{},"你是對的","。",{"title":125,"searchDepth":146,"depth":146,"links":3258},[],{},"\u002Fauthors\u002F阿西狄亞",{"description":3246},{"loc":3260},{"github":3264},"https:\u002F\u002Fgithub.com\u002FAcedia0130","authors\u002F阿西狄亞","q5ECEDl8-0Y33tPck0lYZnzPjFdJkrOnBN7HkAO3pls",[],[3269,3278,3287,3296,3305,3314,3323,3332,3341,3352],{"id":3074,"title":3075,"avatar":3076,"banner":2948,"bio":3077,"body":3270,"description":125,"extension":2947,"meta":3274,"name":3075,"navigation":2950,"path":3083,"seo":3275,"sitemap":3276,"social":3277,"stem":3090,"__hash__":3091},{"type":8,"value":3271,"toc":3272},[],{"title":125,"searchDepth":146,"depth":146,"links":3273},[],{},{"description":125},{"loc":3083},{"website":3087,"twitter":3088,"github":3089},{"id":3093,"title":3094,"avatar":3095,"banner":3096,"bio":3097,"body":3279,"description":125,"extension":2947,"meta":3283,"name":3103,"navigation":2950,"path":3104,"seo":3284,"sitemap":3285,"social":3286,"stem":3110,"__hash__":3111},{"type":8,"value":3280,"toc":3281},[],{"title":125,"searchDepth":146,"depth":146,"links":3282},[],{},{"description":125},{"loc":3104},{"github":3108,"twitter":125,"website":3109},{"id":3113,"title":3114,"avatar":3115,"banner":3116,"bio":3117,"body":3288,"description":125,"extension":2947,"meta":3292,"name":3123,"navigation":2950,"path":3124,"seo":3293,"sitemap":3294,"social":3295,"stem":3129,"__hash__":3130},{"type":8,"value":3289,"toc":3290},[],{"title":125,"searchDepth":146,"depth":146,"links":3291},[],{},{"description":125},{"loc":3124},{"github":3128,"twitter":125},{"id":3132,"title":3133,"avatar":3134,"banner":2948,"bio":3135,"body":3297,"description":125,"extension":2947,"meta":3301,"name":3133,"navigation":2950,"path":3141,"seo":3302,"sitemap":3303,"social":3304,"stem":3146,"__hash__":3147},{"type":8,"value":3298,"toc":3299},[],{"title":125,"searchDepth":146,"depth":146,"links":3300},[],{},{"description":125},{"loc":3141},{"github":3145},{"id":3149,"title":3150,"avatar":3151,"banner":2948,"bio":3152,"body":3306,"description":125,"extension":2947,"meta":3310,"name":3150,"navigation":2950,"path":3158,"seo":3311,"sitemap":3312,"social":3313,"stem":3163,"__hash__":3164},{"type":8,"value":3307,"toc":3308},[],{"title":125,"searchDepth":146,"depth":146,"links":3309},[],{},{"description":125},{"loc":3158},{"github":3162},{"id":3166,"title":3167,"avatar":2948,"banner":2948,"bio":3168,"body":3315,"description":125,"extension":2947,"meta":3319,"name":3167,"navigation":2950,"path":3174,"seo":3320,"sitemap":3321,"social":3322,"stem":3178,"__hash__":3179},{"type":8,"value":3316,"toc":3317},[],{"title":125,"searchDepth":146,"depth":146,"links":3318},[],{},{"description":125},{"loc":3174},{"github":125},{"id":3181,"title":3182,"avatar":3183,"banner":2948,"bio":3184,"body":3324,"description":125,"extension":2947,"meta":3328,"name":3182,"navigation":2950,"path":3190,"seo":3329,"sitemap":3330,"social":3331,"stem":3195,"__hash__":3196},{"type":8,"value":3325,"toc":3326},[],{"title":125,"searchDepth":146,"depth":146,"links":3327},[],{},{"description":125},{"loc":3190},{"github":3194},{"id":3198,"title":3199,"avatar":3200,"banner":3201,"bio":3202,"body":3333,"description":125,"extension":2947,"meta":3337,"name":3199,"navigation":2950,"path":3208,"seo":3338,"sitemap":3339,"social":3340,"stem":3213,"__hash__":3214},{"type":8,"value":3334,"toc":3335},[],{"title":125,"searchDepth":146,"depth":146,"links":3336},[],{},{"description":125},{"loc":3208},{"github":3212,"twitter":125},{"id":3216,"title":3217,"avatar":3218,"banner":3219,"bio":3220,"body":3342,"description":3225,"extension":2947,"meta":3348,"name":3217,"navigation":2950,"path":3229,"seo":3349,"sitemap":3350,"social":3351,"stem":3235,"__hash__":3236},{"type":8,"value":3343,"toc":3346},[3344],[21,3345,3225],{},{"title":125,"searchDepth":146,"depth":146,"links":3347},[],{},{"description":3225},{"loc":3229},{"twitter":3233,"github":3234},{"id":3238,"title":3239,"avatar":3240,"banner":2948,"bio":3241,"body":3353,"description":3246,"extension":2947,"meta":3365,"name":3239,"navigation":2950,"path":3260,"seo":3366,"sitemap":3367,"social":3368,"stem":3265,"__hash__":3266},{"type":8,"value":3354,"toc":3363},[3355,3357],[21,3356,3246],{},[21,3358,3359,3252,3361,3256],{},[25,3360,3251],{},[25,3362,3255],{},{"title":125,"searchDepth":146,"depth":146,"links":3364},[],{},{"description":3246},{"loc":3260},{"github":3264},1778507372958]