It wasn't difficult for Sunny and Robert to find the train tracks leading away from the Loop Factories. It looked like a couple of trains were leaving as well, carrying armor to different parts of Javaland, as shown through the large label "suitsOfArmor" on the side of the trains. Sunny frowned thoughtfully when she saw that. "Hey, Robert, wasn't Eniac's house labeled with something like that too?" She flipped through her notebook and found the sketch she'd made of the house. "Yeah, it had ‘houseOfEniac' with a lowercase ‘h' and an uppercase ‘O' and ‘E'."
"That's called camelCase," Robert said. He shrugged. "It's just a common way of naming variables if you have to use more than one word. Makes it easier to read than squishing all the words together with the same capitalization, no?"
Sunny thought about that for a moment. "Hm, I guess that makes sense." Before she could ask anything else, she was distracted by the sight of the train station.
There were multiple tracks next to roofed areas where passengers were waiting. The sound of their chatter reached Sunny's ears, and with the help of Eniac's translation device, she could pick up snippets of conversation.
"I can't wait to see Method City!" A young girl bounced on her toes next to her family.
Nearby, an older Javalandian asked, "Is our train going to be late?"
"Ugh, I don't want to go to work."
That last one reminded Sunny of her parents, and suddenly she thought of what Robert had said about the previous Earthling to come to this world. She gulped and couldn't help but feel a pang of homesickness. Who knew how much time had passed back on Earth? What if her family was missing her already?
"You alright?" Robert was looking at her quizzically.
"Oh! Y-yeah." Sunny tried to smile. "We, um. We need tickets, right?" She shook herself out of her thoughts and looked around for a place to buy tickets.
Robert frowned, but followed Sunny after a moment.
Sunny walked up to a nearby booking clerk and smiled, focusing on the present. "Hello! Where's the closest stop to Spaghetti Code Mountain?"
The lady raised an eyebrow at her. "Something's been up with the mountain lately. Red text flying there, strange happenings… You sure you want to go?"
Sunny nodded decisively.
"Suit yourself. The closest the train can get you is Method City, then." She produced a pair of tickets. "Four and a half bars, please."
Sunny turned to Robert. "Would you happen to have any money on you?"
Robert rolled his eyes, then reached into a compartment on his side and pulled out some blocks that had a metallic shine to them. He pushed them over the counter.
"Thank you!" Sunny beamed, then took the tickets and walked with Robert to a bench to wait for the train.
Sunny spent a couple minutes observing the other passengers, then a couple more minutes observing the trains. Each of the trains that pulled in had numbered compartments. "Why do the numbers start at zero?" Sunny asked.
Robert floated next to the bench. "In Java, arrays are 0-indexed, so they start at zero."
"Arrays…?" Sunny had heard of the word "array" being used in contexts like "an array of chocolates" or something before, but she suspected it meant something different here. Just like how a double didn't mean a double scoop of ice cream.
"Think of arrays like collections of variables. You can have integer arrays, double arrays, String arrays, and more."
"Oh-kay." Sunny nodded slowly, although she didn't get what exactly arrays were yet.
"You can visualize arrays like rows of boxes. Each box contains a variable– a value– and has an index. The indices are kind of like labels for each box in the array. You can use the index to get values from the array, or to change values in the array."
Robert opened the computer in his head. "Here's an example."

"Read line three as, ‘int array numbers equals new int array size 5.' The first set of brackets indicates that we're creating an array, which in this case would be an array called ‘numbers' of size 5."
"Riight. So the number inside the last set of brackets is the size?"
"Exactly. Then, on line four, we set the first box in the array to hold the value 1, and on line 5, we set the last box to hold the value 100."
Sunny raised her hand. "Do arrays have to store things of the same type? Like, you said you could have int arrays, and double arrays, but can you put a double in an int array?"
Robert shook his head. "The short answer is no. In Java, arrays can only hold one type. Although there are type conversions… Anyways, finally, since arrays are initialized with the default value of 0 in each box, printing numbers[2] prints 0."
Sunny blinked, trying to absorb all that information. "Okay, I kind of get it." She pointed to one of the trains pulling in, which had compartments labeled 0 to 11. "So that train could be represented as an array of size 12? Except it would hold people instead of numbers?"
"Correct. I must be a good teacher." Robert smirked.
Sunny scoffed. "Or I'm a good student."
The train's doors opened, and a stream of Javalandians exited. The station's noise level increased for a few moments, then people started to board the train.
Sunny thought back to Eniac and the variapets. "Is it possible for someone to change this array's size, just like Eniac could change the variapets' size?"
"No; arrays in Java have a fixed size. You could set an array to be a new array of a different size, but if you want an array to just change its size, you'll have to use something different like an ArrayList instead." Robert hummed. "Plus, there's the fact that there are restrictions on speaking code, such as that people can only code what they own, or living beings like the variapets if they have their consent."
"Ah, makes sense." Sunny supposed they couldn't have people running around, speaking code and changing the size of things willy-nilly.
The train pulled out of the station again, and another one pulled in in its place. Sunny checked the number on the tickets. "Oh! That's us!" She grinned at the robot. "To Method City we go."
Points: 4173
Reviews: 3779
Donate