Java Programming Streaming Video Lectures On-Demand Colin Archibald, Ph.D.Valencia Community College Orlando, FL 32811 This is a complete course in the Java language. It uses the the free programming tools from Sun Microsystems, and Eclipse. It is intended for students who have some background in computer programming. Beginners are referred to the video lecture course Computer Programming Concepts. Students completing this course will have a solid understanding of the Java language, including data types, control structures, operators, arrays, classes, objects, inheritance, interfaces, and polymorphism.. These videos have moved to YouTube. Updates will only be posted there. Here is a link to the PlayList: https://www.youtube.com/playlist?list=PL6F117B39113D9108 | |
|
|
Video Lecture Segments Click on the name of the segment. |
Outline of Video Contents Get the Power Point Slides here. |
01
Java Programming Getting Started 22 mins. |
Java syntax Getting around in Eclipse The history of Java - why has it survived radical changes in computing? |
02 Variables, Data
Types, Arithmetic Operators 17 mins. |
Variables and data types - int and
double primitive types Compile-time errors and Run-time errors Naming variables - legal and conventional Arithmetic expressions - precedence order Operators have a data type |
03 More Data Types
- Mixed Type Expressions 31 mins. |
The 8 Primitive types Literal constants Java is "strongly typed" Operators work on like-type operands Promotion can happen implicitly, but demotion must be explicit. Cast operators There are no arithmetic operators for byte and short In mixed-type expressions, the type of the operator is determined based on the type of the operands at the time that operator will execute A boolean variable hold only true or false, and cannot be promoted or demoted. |
04 Short-cut Operators 20 mins. |
+= -= *= /= %= Increment and Decrement operators ++ -- Declaring constants with "final" |
05
Relation Operators and Selection 39 mins. |
Selection statements if, if-else, switch, ? : |
06
Logical Operators 14 mins. |
&& & || | ! The effect of short-circuiting operators |
07
Repetition 20 mins. |
where do you start, stop, how to get there? |
08
Problem Solving with Repetition and Selection 41 mins. |
Get comfortable walking through code inteh Eclipse debugger |
09 mins. |
This space left blank :) |
10 Arrays 30 mins. |
Java arrays know how many elements they have
.length
Space for an array is allocated dynamically at run-time
The indexes of an array start with 0 (zero).
Eg. an array with 10 elements has indexes 0 – 9
Arrays can be of any data type – elements are used as if they
are simple variables of that type
Array elements are initialized to 0, 0.0, false, or null
A variable can be used in the allocation of space for an
array
for (int i = 0; i < myArray.length; i++){
array[i] = …
There is a loop in Java for reading arrays.
Enhanced for loop, for each
for( double element : array) |
11
2-D and Ragged Arrays 20 mins. |
Declaring 2-D arrays [][] Arrays know how big they are - the length property Looping through the rows and colums with a nested for loop The Ragged array Allocating space for ragged arrays Looping through the elements of a ragged array is the same as rectangular arrays |
12
Static Methods 25 mins. |
Dividing up the work into functional modules called "Methods" Return type, name, parameter list Use camelCase with a verb for method names Pass information into a method through the parameter list You can pass primitive or arrays to a method All methods have a return type even if it is "void" which means that the method does not return anything |
13
Classes and Objects 33 mins. |
A class is a blueprint for the creation of objects The HAS A relationship between the class and its instance variables (private) Conventions are strong, and should be followed in all cases Constructor methods, accessor and mutator methods (public) toString method - public String toString() { |
14
Composition static this 43 mins. |
Class variables and methods – belong to the class – static Instance variables and methods – belong to the object <dynamic> Static methods – belong to the class, and are called from the name of the class double result = Math.sqrt(100); // static method call – use the name of the class int myMonth = birthday.getMonth(); // dynamic method call - must be called from an object this - a reference variable to the object that was used to call the method. this - does not exist in a static method – no object was used – the name of the class was used. Static methods can only call other static methods. Dynamic methods can call other dynamic methods AND can call static methods. |
15
30 mins. |
|
16 Inheritance IS A 40 mins. |
Java is a single – inheritance language; each class has one
parent |
17
Inheritance Rules 10 mins. |
Access Modifiers – private public protected – inheritance implications A final variable, method, class – can’t change them Variable can’t be assigned a new value Method cannot be overridden Class cannot be extended |
18
Polymorphism 41 mins. |
Compile-time type vs. Run-time type - satisfy the compiler
first Dynamic method binding – call the method from the object that you actually have, not the method from the Compile-time class Write methods that can take different kinds of objects based on the data type of the parameter, i.e. a method that want you to pass an Animal, you can pass anything that IS A Animal. (Polymorphism) You can use the instanceof operator to determine what kind of object you have at runtime. The equals method – you should override this method. It is expected to be in your classes. |
19
Abstract Classes and Methods 22 mins. |
Any class that has one or more abstract methods is an
abstract class You cannot make an instance of an abstract class Abstract classes still have concrete methods, data, constructors, toString… Abstract classes ‘impose’ something on all of the sub classes Abstract methods must be overridden by the sub-class. The name of an abstract class can still be used as a compile-time type |
20
Interfaces 40 mins. |
Other than a class the only identifier that starts with a
CaptialLetter An interface contains public abstract method signatures Interfaces do NOT have concrete methods, data, constructors, toString… Interfaces do ‘impose’ something on all classes that agree to implement them The name of an interface can be used as a compile-time type This is another form of polymorphism. Write a method that takes and object that is from a class that implements an interface. In this type of polymorphism, we know something about the object, but we don’t know anything about its inheritance. |
Appendix |
|
Appendix 1:
Installing Eclipse 11 mins. |
Download and install the Eclipse development environment for Java programmers We will use the Standard Edition of Java SE Create Hello World in Java with Eclipse to make sure everything is working |
Appendix 2: Binary Numbers 30 mins. |
These number systems appendices are borrowed from another course and are only useful for Java programmers who need to know what the bits look like inside the integer data types..
|
Appendix 3: Hexadecimal Numbers 25 mins.
|
|