Skip Top Navigation Bar

Create A Face Mini-Lab

This series of labs require you to write program code to use the following topics.

Prepare Your IDE

The Java Playground is great for trying out segments of code, but if we write print statements to show that the output doesn't move to the next line, it won't behave as we expect. That is because it will treat each print statement distinctly. At this time, to test out some code, we will want to move over to an IDE. If you need help, please reference the Getting Set-up page.

In this section, we will be using preview features in JDK 24. To use features that are still in preview, you will need to enable preview features in your IDE.

  1. Create a .java file. The file name should start with an uppercase letter.
  2. Use the following main method template. Add your statements to the body of the main method. A comment is in the body of the main. A comment is ignored by the compiler. Comments are added to the program code to help programmers understand what the program code does. There are three types of comments:
    • single-line comments start with //
    • multi-line comments start with /* and end with */
    • document comments, which generate documentation, start with /** and end with */
void main() {
    //add your statements here
}

Mission - Character Art

Use text blocks and escape sequences to create a face with characters. Here is an example of what your face might look like, but feel free to be creative and make your face your own.

A face made of characters.

Before you write program code to create your face, it is recommended that you draw you face out on graph paper. Place each character in it's own box. The font used when printing the output to the screen will space out each character equally, so using graph paper will help you to know just how many of each characters you will need. For example, if you wanted a part in the middle of the hair on top of the face, you might draw out:

\\\\////

Because of escape sequences, you will need twice the number of backslash characters as forward slash characters, so the line might be:

print("\\\\\\\\////");

Mission 1

Use escape sequences to create your face.

Mission 2

Use text blocks to create your face.