Code.org Notes Lesson 1- 15
Week 1 and 2
public class ClassName {
public static void main(String[] args) {
}
}
-
Defining an object
ClassName objectName = new ClassName()
- Example:
Painter myPainter = new Painter();
-
Objects have attributes which are characteristics of an object
- A class is the blueprint that objects are created from. Instantiating an object calls the constrcutor to create an object.
- A constructor is code that has the same name as the class and tells the computer how to create a new object
-
Parameter: a variable in the method/constructor signature that defines the type of value to receive when the method or constructor is called
- in the definition of a function
-
Argument: a value passed to a method/constructor when the method or constructor is called
- when calling the function
//if statement syntax
if (condition) {
//do this
}
Lesson 6
-
super
is a keyword used to refer to the superclass -
constructor signature is the first line of the constructor that includes the
public
keyword, constructor name, and values to specify when an object is createdpublic class myClass{}
- inheritance is an OOP principle where a subclass inherits/extends the attributes/behaviors of a superclass