Computer Science AP Java Video Course

atomictoddler.com -   [index]     [Page 2]     [Page 3]     [Page 4]     [Page 5]  

***UPDATE - I had to move the videos for this course to a new YouTube channel.
***Please access the videos from this new channel from now on
***and share, subscribe, and watch as much as you can with others!
***I will be deleting the old channel very shortly!
*** https://www.youtube.com/channel/UCw2zv1zmT5ak5olBgB7IqmA



10 CLASSES

All the Java code and Classes seen in this section's videos are in the project call ClassTime in the projects folder.

Watch "Classes Creating"
You don't want to dump all of your code inside of 'public static void main' - this leads to code that is not reader friendly or easy to manage or build upon in the future. Instead you want to group it into classes that will represent objects. Classes should contain code that is related in function and design. This is a big topic in the AP course and a big topic in many modern programming languages. It will take several classes (in school) to cover everything we need to know about classes (in Java).

Code - Class Writing Practice
From the documents folder open up the file ClassPractice01.
Complete Section 01 only.
You will continue to use this worksheet throughout this unit to build and create several classes so keep the document and these files nearby!

Watch "Classes Constructors"
When you create a class, you have the option of writing a constructor for the class. The constructor is a method that is called when you instantiate an instance of the class. You can write constructors that don't do much, or you can write constructors that run code to set variables, perform initialization tasks, etc.

Code - Constructor Writing Practice
Complete Section 02 of ClassPractice01.

Watch "Classes Constructors 2"
A little extra information regarding the argument/parameter names and the word 'this'.

Watch "Classes Simple Methods"
Organizing your class code into methods is easy to do and easy to use. Learn how.

Code - Simple Method Writing Practice
Complete Section 03 of ClassPractice01.

Watch "Classes Methods and Parameters"
Methods can accept parameters (also called arguments) to make the method more versatile and useable for more

Watch "Classes Private Mutators"
If your class has private members then you might want to give a programmer the ability to change (mutate) the values of those variables. To do this you will have to add mutator methods to your class. Learn how.

Watch "Classes Private Accessors"
The private members of a class are not accessable by other classes (including a runner class!). If you want a programmer to be able to 'see' the values of private members then you will have to provide accessor methods that return the values of these members.

Code - Methods with Parameters and Return Values
Complete Section 04 of ClassPractice01.

Watch "Classes toString "
When you print out a reference to an object (example where C is a Calcultor instance: System.out.println( C ) ) the memory address of the object is printed out. Behind the scenes the 'toString' method of the class is being called. By default the toString method is set up to print out the memory address of the object - but you can change that! Learn how.

Code - toString Methods
Complete Section 05 of ClassPractice01.

Watch "Classes in Classes 01"
Watch "Classes in Classes 02"
Watch "Classes in Classes 03"

That's right, three videos.
*Before watching this video open up the project Classes in Classes found in the project folder. It might help you to have the code seen in the video in front of you to read or fiddle with as you watch.*
So far we have given the classes that we have written members (or fields) that have been integers, doubles, and Strings. But you can add any type of field to a class. This video will show you a few examples of how you code with classes that contain fields that refer to other types of classes.

Watch "Null Pointer Errors"
Now that you are starting to use more instances of classes in your code, you are destined to come across the 'Null Pointer Error'. This video will explain what it is, why it is happening, and show you how the debugger can quickly help you find the error.

Code - Classes in Classes
Complete Section 06 of ClassPractice01.

Review The Code - "Class Time" and "Classes in Classes"
If you haven't already downloaded these projects from the projects folder, then go grab them. Look over all the classes that are contained in them. Some of them have been used in the videos and some have not. You should be familar with these classes as some of the questions on your assessment will refer to them - if you are already familar with them, all the better!

11 ARRAYLIST CLASS

Watch "ArrayList Introduction"
You've learned to use arrays to add, insert, and delete values. Now lets looks at a class called ArrayList that is designed to make all these tasks VERY EASY for you.

Watch "ArrayList Object Types"
ArrayLists have a variety of methods available to make creating and managing a list of 'things' easy. These 'things' are Objects. Learn more now!

Watch "ArrayList Numbers and Your Own Classes"
Even though ArrayLists cannot store primitive types directly, they can still stores numbers and other primitive types by using wrapper classes. And what about your own classes - can they be put in ArrayLists? Of course they can.

Review - ArrayList Basics
Open the document ArrayList_Basics from the document folder. Answer the questions that review some ArrayList basics.

Practice Coding - ArrayList Practice
Now it's time to code a few ArrayList problems. Grab the project ArrayList_Practice from the projects folder and the document ArrayListPractice from the documents folder. Go through the short challenges in the document.

Complete the Class - WordManager
The WordManager class needs your help! Open the document WordManager_Class and the project ArrayList_Practice (you might already have this project open). Read the specifications for the WordManager class and then complete the class so it works perfectly! This class will be used in a future project so make sure you get it working properly.

12 STRING CLASS

We've been using the String class for a while now, but only in the most basic way. This unit will take a look at how Strings are just an array of characters (symbols). The starting counts at zero just like arrays and there is a truckload of methods that come built in with the String class.

Notes - "String Notes"
Open the document StringNotes found in the documents folder. Have it near you when watching and coding the following sections.

Open Project "StringExamples"
Open the project called StringExamples from the project folder. It contains the files used in this sections videos and examples of how to create a class to write some string practice methods and test them with a runner.

Watch "String Class"
Strings are not a primitive type. When you make a String you are making an instance of a class that comes with all the methods that are coded into the String class. In the AP Computer Science course you are only tested on a handful of these methods. This video will walk you through the 6 or so methods that you need to know. This video uses the class StringALings in the example project.

Explore the String Class
Take a moment and code a few lines using the String class methods you were just shown. Create some strings, use each method you were shown once. System out the results of the methods and verify that you understand what each method is doing. If you can't use each method in a simple settings, using them to solve problems will be difficult!

Read and Predict - "String Code Reading"
Now that you have a basic idea about how the methods work, read the document String Code Reading that is found in the document folder. These problems will show you some code. Predict the output. Answers are in the document String Code Reading Solutions. How did you do?
**do not do the code samples that use the method 'compareTo'**

Watch "String Sample Problems"
So how do you use these methods to help you solve some everyday problems with Strings? Watch this video to get an idea of what you can start doing with the methods in the String class. This video uses the classes StringPractice01 and StringPractice01Runner in the example project.

Code It - "String Theory"
Here are a few String problems for you to try your hands at. They can be solved a variety of ways using the methods in the String class. The worksheet will ask you to create a new project. In this project, create a class called StringTheory and code the given methods. To test this class create a runner class. Refer to the string examples project if you need a hint how to set this up. Good luck beginning a string master!

 

13 FILE READING WRITING

Almost every software program will read or write information to the hard drive (or somewhere?). In this unit we will give you an introduction to reading and writing information using simple text files and a few classes that are already made for you. The sample files used in these videos come from the SampleReadWrite Project in the projects folder (helpful reference code when adding file reading and writing to your projects).

Watch "File Reading Buffered Reader"
Reading from a text file isn't that difficult. Just takes a couple of lines of code and the help of the FileReader and BufferedReader class.

Watch "File Reading Handling Exceptions"
Reading from a text file isn't that difficult. Just takes a couple of lines of code and the help of the FileReader and BufferedReader class.

Watch "File Writing Buffered Writer"
Writing to a text file is perfect for saving user data, program information, settings, or anything else that you may want to read from the file when the program starts up the next time. It's probably easier than reading from the text file! This video will explain the FileWriterFrame class in the sampleReadWrite project. Note the use of the ' /n ' in file writing!

Code It - "Read and Write"
Open the document ReadandWrite from the documents folder. There are a few simple (hopefully) short read and write challenges to do! Pick two of the four problems that will get you to read and write files.


14 STRING AND ARRAYLIST AND CLASSES PROJECT

We are going to combine the topics of GUI, ArrayList, and Strings to create HangPerson (the politically correct version of HangMan).
Open the document HangPerson Project from the documents folder for instructions.
There is also a document called HangPerson Hints in case you need some help.

Watch "HangPerson Demo"
Heres a quick video to show you what HangPerson could look like when done.

15 VARIABLES IN MORE DETAIL (Primitive VS Reference)

In this section you will learn a few of the finer deetails about what is going on 'behind the scenes' with variables of various types. What you learn will have a direct impact on how you will decide to use your variables in your future programs.

Watch "Primitives Vs Reference Variables"
Two types of variables that you create in Java are primitive types and reference types. Primitive type variables store a value and reference type variables store the memory address of an instance (of an object) in memory. Watch this introductory video that will hopefully show you the difference between these two types of variables.

Watch "Strings Immutable"
String variables are a reference type variable, BUT there is a little extra catch - they are 'immutable'. This video will introduce you to the idea of string literals, string objects, and the constant pool that Java uses with strings.

Watch "Parameters as Copies"
When you pass a variable into a method as a parameter, the value of your variable is copied to become the value of the methods parameter. Huh? Watch the video to find out. This is actually a very important idea and is how all Java method parameters work. This has consequences on how your methods will affect changes on variables you pass into methods. A must watch now that you are using methods more often.

Watch "Methods to Change Primitives and Strings"
Sometimes you want a method to change the value of a variable you pass in as a parameter. But how do you do this for primitive types and Strings that are not affected by methods that try to change their value? This video will show you what to do.

Practice Questions - "Variables In Detail Review" *coming soon*
A few review questions for this section.