Colorado State University

CS160: Foundations in Programming: Summer 2016


Recitation R1 - Java Variables, Data Types, and Expressions


Preview

This lab is broken into two parts, the goals are as follows.

Part I:
Part II:

Getting Started


Introduction to Primitive Types

Follow the instructions below, in order.
  1. Add declarations of the following variables to the main method:


  2. Print the following expressions, using System.out.println:

  3. NOTE: The instructor will show you how to copy statements to minimize typing!


  4. Create comments in your Java file that answer the following questions:


  5. Experiment with different print statements, as follows:


  6. After making sure the following requirements are satisfied, turn R1P0.java into Checkin


  7. Switch to R1P1.java


Learning About Reference types: Strings

Your TA will discuss the String class: Your TA will discuss the Scanner class:

Introduction to Reference Types

  1. Add declarations for the following variables to the main method:


  2. Print the following expressions using System.out.println:


  3. Create Scanner object to read from the keyboard.

  4. Read in and print an integer:


  5. Read in and print a double:


  6. After making sure the following requirements are satisfied, turn R1P1.java into Checkin

Once you have submitted R1P0.java and R1P1.java using the Checkin tab on the course website you are finished.
© 2016 CS160 Colorado State University. All Rights Reserved.