In this lesson, we learn about methods in Java. Methods allow us to break down our code into reusable parts, avoid using repeated code, and simplify our code.
Students will be able to…
In this lesson, we continue to build our understanding of methods and introduced to parameters. Parameter are inputs to methods.
If methods are boxes, then parameters are inputs to our boxes (what goes inside the box).
Parameters allow us to generalize our methods so that they can solve more than one specific instance of a problem, and instead can solve different versions of the same problem (for example, add 10 to any given number).
Students will be able to…
Think of a method like assigning a task. A return value is giving you the completed work.
This allows you to write methods that do some work for you and send back the result.
Parameters are like inputs into the function, and the return value is output.
Students will be able to…
Comments are an important part of programming style. Programs are usually written by teams of people and maintained for many years. Others need to be able to read your code and understand what is going on.
This lesson introduces Javadocs, which are a standard, agreed upon way of commenting Java code. There is a tool, also called Javadoc, that is able to read Javadoc comments and create clean, clear documentation for your Java programs. Javadoc refers to both the tool and the style of commenting Java code.
From now on, we will be writing Javadoc comments in our programs.
Students will be able to…
Strings come prepackaged with several methods that we can use to help us do cool things! In this lesson we learn how to find and read documentation about how to use the String methods, and we’ll write several programs that call methods on Strings in order to get information about them and manipulate them to form new Strings.
Students will be able to…
In this lesson, we’ll examine the similarities and differences between the String
class and the char
primitive type. Strings are simply sequences of char
s.
We also learn that all char
values have a corresponding int
value. chars are actually stored as numbers! For example, 65 corresponds to ‘A’, 66 corresponds to ‘B’, and so on. We’ll learn about special characters like tabs, quotes, and new lines, and how to store and print these special characters using escape sequences like ‘\n’
Lastly, we learn about the Character class. The Character class provides several useful methods that allow us to manipulate and get information about char values.
Students will be able to…
char
and the class Character
char
values to int
values using castingint
values to char
values using castingchar
valuesAll programs have bugs at some point in the development process. Bugs are ok! They show us exactly where the problems are in our code and give us helpful information so that we can fix these problems.
When there is a bug in your program, Java will actually provide helpful information about where the bug is and what kind of bug is occurring by throwing an Exception. In this lesson we’ll learn about the different kinds of exceptions and what they mean. That way, when we try running our programs and see exceptions, we’ll know how to use that information to debug our programs!
Students will be able to…
We’ve learned about writing our own methods that take in parameters and return return values. We’ve learned about the relationship between Strings and characters. We’ve learned about using the methods of the String class and the Character class. We’ve learned about looping through the characters of a String using a for loop. It’s time to put that all together to write some methods that perform some advanced manipulation of Strings.
Students will be able to…
This lesson is a summative assessment of the unit’s learning objectives.
Assess student achievement of the learning goals of the unit