`lowerCamelCase` is a naming convention where the first letter is lower case, and each subsequent start of a word is upper case.
A command is an instruction you can give to Karel.
Documentation for all Karel Commands and Syntax
The run method is where a Java program begins.
Indentation is the visual structure of how your code is laid out. It uses tabs to organize code into a hierarchy.
A method is a way to teach the computer a new command
Defining a method means to teach the computer a new command and explain what it should do when receiving that command.
Calling a method actually gives the command, so the computer will run the code for that method.
The part of the method that contains the commands
Breaking down (decomposing) your code is splitting it up into several smaller, simpler methods
Programs that “Read like a story” have good decomposition and make the code easy to follow.
Top down design is a method for breaking a problem down into smaller parts.
The way your code is written is the style. It covers the aspects of the code that goes beyond whether or not it just works.
A message in your code that explains what is going on.
Assumptions we make about what must be true before a method is called.
What should be true after a method is called
SuperKarel is like Karel but already knows how to turnRight() and turnAround()
A for loop lets us repeat code a **fixed number of times**.
A variable used to count the number of times an action has been performed.
Otherwise known as Don’t Repeat Yourself, this principle is designed to help eliminate repeated code and reduce the complexity of a solution
A control structure lets us change the flow of the code.
A problem when using a while loop where you forget one action at the beginning or the end.
An if statement lets you ask a question to the program and only run code if the answer is true.
Control structure that lets us run either one section of code or another depending on a test.
`boolean` is a Java type that can either be true or false
An edge case is a problem in your code that only occurs in extreme situations.
Traditionally the very first program you write when learning a programming language, a program that prints "Hello world" to the user.
Java method that lets us print out a line of output to the user
Java method that lets us print output to the user, without ending the line printed.
The `"` character
A symbol or container that holds a value.
`int` is a Java type that represents an integer (a whole number)
String is a Java type that represents a string of characters (text)
`char` is a Java type that represents a single character (a single letter)
`double` is a Java type that represents a real number with decimal values
Declaring a variable is defining it for the first time.
Initializing a variable is giving it an initial value, or a starting value.
Assigning to a variable is updating the variable's value
The type of a variable defines what kinds of values the variable can hold
Java method that lets us read in a line of input from the user as a String
Java method that lets us read in an integer input from the user
Java method that lets us read in a decimal value input from the user
Java method that lets us read in a true or false value input from the user
The modulus operator (written as % in most programming languages) divides two numbers and returns the remainder.
When two integers are divided, the decimal values are truncated, or chopped off.
Casting is turning something of one type into another type
To flip a boolean value, or take the opposite of a boolean value. If you negate true, you get false. If you negate false, you get true.
Logical operator that ANDs two boolean values. Written as `&&`. `a && b` will be true if both `a` and `b` are true.
Logical operator that ORs two boolean values. Written as `||`. `a || b` will be true if `a` or `b` is true.
Logical operator that negates a single boolean value. Written as `!`. `!a` will be true if `a` is false, and false if `a` is true.
Used to make logical associations between boolean values.
A loop that has no way of stopping, and will keep looping forever.
A loop, most often set with `while(true)`, that has a `break` statement in the loop body.
A constant that has the specific purpose of being the value that breaks out of a loop.
The `break;` statement breaks out of the current loop, without executing any more code in the loop.
A short cut when evaluating boolean expressions. If the result can be determined solely by the first part of a boolean expression, the second part is not evaluated, it is skipped.
Laws that define how we can negate an AND statement and how we can negate an OR statement
An object is a single instance of a Java class. An object has both state and behavior.
Primitive types are the basic, simple data types that are inherent to Java (int, double, char, and boolean)
Concatenation is another word for combining. Concatenating Strings is when we add Strings together.
A variable passed into a method from outside the method.
The `return` statement exits a method and returns a value.
The value returned from a method.
A method's return type is the type of value returned from that method.
A method's signature is the name of the method and the parameter list.
A method's call site is the point in the code where the method is called.
Documentation showing the syntax and examples for how to use the various features of Java.
A specific standard for commenting Java programs. Javadoc is a format to follow when commenting in order to clearly explain your code.
A class is a template, or a blueprint, from which Java objects are created. All Java programs start with a class.
A substring is a smaller sequence of characters in a larger String.
Unable to change. Strings in Java are immutable, meaning you can't change it once you make it. If you take a substring of a String, or concatenate something to a String, the result is a *brand new* String, rather than a modification of the original.
Escape sequences are characters with special meanings.
A method called on the Class, rather than on a specific object of the Class.
An error in the actual Java code. The code will not **compile** into an executable program, because there are errors in the text of the code.
A tool that compiles your Java code, it takes the Java code you've written and turns it into an executable program.
An error that happens while the program is running. Even if the code is written with the proper syntax, there are things that can go wrong while the program is running.
An exception is thrown by Java when a **runtime error** is encountered. The exception provides information about what kind of error occurred.
Programming model that focuses on **objects** and the data and actions associated with the objects.
The state of an object is all of the object's associated data. It is the *state* that the object is in.
The behavior of an object is what the object is able to do. It is the actions that can be performed by the object.
Instance is what you call a specific object constructed from a class. Instance and object generally refer to the same thing. An object is a specific instance of a class.
When someone else creates a Class (like `String`, or `Randomizer`), and you are using the functionality of that Class in your program, your program is a *client* of the class. You are using the class as a client.
A variable defined in a Class, for which each object of the class has its own copy.
A constructor is a special method of a Class that constructs a new object (a new instance) of the Class and sets the initial values for the instance variables.
toString is a special method you write in your class that returns a String representation of the object.
An instance method is a method that defines the behavior of an object. It defines an action that the object can perform.
Visibility (usually `public` or `private`) defines who has access to something (usually a variable or method). Public means code outside of the class can access, private means only code inside the class can access.
An instance method that allows the client to **get** the value of an instance variable on an object.
An instance method that allows the client to **set** the value of an instance variable on an object.
A variable or attribute of a class that is shared between **all** instance of a class. Each instance **does not** get their own copy.
Classes can have multiple methods with the same name, as long as the parameters to those methods are different. Doing this is called "overloading" a method.
A variable that is restricted to use in a certain scope of a program
If two variables have the same name, and exist inside of the same scope, the variable with the *more specific* scope takes precedence. This is called shadowing. Local variables and parameters shadow the more general global variables (instance variables).
Related classes are grouped together into packages.
The `this` keyword is a reference to the current object (the current instance).
When an object is assigned to a variable, the variable doesn't hold all of the object's data, it only holds a *pointer* to the object's data. The variable holds a memory location (think of it as a pointer to that memory location), and the object data is stored at that memory location.
Before an object variable is initialized, it doesn't point to any memory. It holds a **null pointer**.
Class hierarchy refers to the arrangement of classes and how they relate to each other.
If a class A extends the class B, then A is a subclass of B.
If a class A extends the class B, then B is the superclass of A.
When a subclass extends a superclass, the subclass inherits all of the static methods, static variables, and public instance methods of the superclass. This is called inheritance.
The `super` keyword lets us reference the superclass when writing code inside of a subclass.
If a subclass defines a new method body for a method defined in the superclass, then the subclass has **overridden** the method of the superclass.
A class, usually at the top of a Class Hierarchy, that cannot be instantiated, because not all of its methods are defined.
A method, written in an Abstract Class, that is not defined. The word `abstract` must come right before the method's return type. It is up to the subclass to fill in the definition for the abstract method.
Polymorphism is the capability of a method to do different things depending on which object it is acting upon.
Also called late binding, this refers to Java choosing the proper method to call at run time, as opposed to at compile time.
An interface provides a list of methods that *must* be defined if a class chooses to implement the interface.
The Comparable Interface is a standard interface in Java that mandates that all classes implementing the Comparable interface must define a method called `int compareTo(Object o)` that returns a positive int if the parameter `o` passed in is *less than* the current instance, returns 0 if it is equal, and a negative int if it is greater.
A particular way of organizing data in our programs.
A data structure that stores a **fixed** number of elements, all of the same type, one after another like a list.
The position of an element in an array. The first element is at index 0, the second element is at index 1, and so on.
Getting a value at a particular index in an array.
The number of elements an array can hold. You can get the length of an array `arr` by typing `arr.length`
Looping through all of the elements of an array
ArrayList is a Java class that is like an Array with extra powers. It can automatically resize and comes with other helpful methods.
A for loop that is written differently so that it loops through each element in a data structure, as opposed to having a loop counter variable that goes from 0 to length-1.
A Java Interface that represents a general List. The interface provides a list of methods that classes should implement if they want to be used as a List.
A 2D Array is an array of arrays, used to represent tables, grids, and matrices.
The ordering of 2D arrays is row-major order, meaning the first index is the row, and the second index is the col. `arr[2][0]` would access the element on the third row and first column.
A for loop written, or “nested”, inside of another for loop. For example:
A data structure that stores key -> value mappings.
A key is the value used to look something up in a HashMap
The value is the result you get when you look up a key in a HashMap. It is the value paired with a key.
A number system defines how we represent numbers. It defines which digits we can use, and what value each position (place value) in a number has.
The binary number system is the Base 2 Number System. It is a number system that only uses 2 digits (0 and 1).
The decimal number system is the Base 10 number system. It is a number system that only uses 10 digits (0 through 9).
The number base of a number system defines how many digits are in the number system, and the base of the exponent for each place value in a number.
The octal number system is the Base 8 number system. It is a number system that only uses 8 digits (0 through 7).
The hexadecimal number system is the Base 16 number system. It is a number system that only uses 16 digits (0 1 2 3 4 5 6 7 8 9 A B C D E F)
Bit means "binary digit". A bit is a single digit in a binary number. A bit can either be 0 or 1.
A byte is 8 bits.
A kilobyte (kB) is 2^10 bytes (1024 bytes) of binary data.
A megabyte (MB) is 2^20 bytes (1024 kB) of binary data.
A gigabyte (GB) is 2^30 bytes (1024 MB) of binary data.
A constant is a variable you define at the top of the program that doesn’t change. The reason to define constants is to store named variables that have relevant values for the program.