Midterm Topics
This is a list of the topics we have covered so far.
The midterm questions can come from any of these.
Read over the notes and review the readings mentioned in them (if any).
Study the example code.
-
Variables
Know the four properties of a variable, name, type, location and contents.
Know the different data types, int, float char boolean etc.
Know that object variables (instances of a class) don't really exist until you
use new.
-
Control Flow
If statements with and without else.
For, while and do loops.
-
Functions
Functions can be used wherever a variable of the return type can be used.
-
Expressions
Know the different operators ( <, >, >+, <=, != ) know the
logical operators ( !, &&, || ) How to combine them.
What is true and what is false?
-
Arrays
Now how to declare and use one dimensional arrays.
Array elements are all the same size.
Arrays cannot be expanded.
Creating an array and creating the objects in it are different things.
See the flashlight code.
-
Classes
Know the syntax of them.
How to use public and private markers.
How to create a main() method.
Name of class must be the same as the name of the file.
-
Java
Source code in .java files.
java file.java
to compile and
javac file
to run.
Source files compiled to .class files.
.class files can be run by any Java system on any OS.
-
Stuff
Applications have a main and are run by themselves.
Applets run in a web browser.
Everything is an object.
Class heirarchy starts with Object.
Single inheritance.