![]() |
Java is one of many languages that is referred to as object oriented. Object oriented programming or OOP is relatively new and quite logical. What makes programming objects harder to understand than swim fins and baseball objects is that they are abstract. You can't see them or feel them or swing them. However, you can classify them and you can name them so objects will have classifications such as packages, classes, interfaces, variables, etc. and names like package java.applet, class java.applet.Applet, interface Runnable, and variable boolean gameOver. The preceding examples are all objects. Everything in Java is an object. The above objects in Java are already coded for you by other Java programmers. When you call them(name them) in your program, the Java language reader(Java Virtual Machine or JVM) in your user's browser knows what they are and what their properties are. You can use these objects with their existing properties to paste them together to make new objects much like you did in the RhollSwimmer example. And like you did in the RhollSwimmer example, you can create instances of these objects with new properties.
These will be the main objects(packages, classes, interfaces, and variables) that we will use to construct our programs. In this class, we will use the packages and interfaces as they are in existing Java code. We will not create new packages or interfaces, merely call them in our programs to use them as is. We will create new instances of classes and variables. So to create new instances of a class or a variable, we will have to give them names. Java, like Javascript was, is case sensitive. While it doesn't matter whether you use capitals or lowercase as long as you are consistent, we will follow the standard Java syntax for these names. Classes start with a capital letter and use a capital letter for each new word in the name, stringing these words into one word. RhollSwimmerBlack was a class-like name. You can use any words you want to create your new classes as long as you capitalize the first letter of each part of the word(ex. classes MyRectangle, BoxBorder, etc.). Variable names start with all lower case letters for the first part of the word and capitalize the first letter of each added on word. We did not have any examples of variables in the rholl analogy, but variables always have a "type of variable" word in front of them. That type is usually a class name or a basic variable type like integer, string, or boolean. Some examples of variables that might be part of the RhollSwimmer example would be Mask strapColor, int finNumber, boolean isDressed. Variable names in Java are almost always named by you, the local programmer. In this class, we will mostly use existing Java packages and interfaces, use or extend some existing Java classes and create some of our own. We will create all of our own variables.
| |
|
Grading
Schedule
Syntax
JavaDocs
Video
Projects
Links