CSU Banner

CS 163/164, 🀨 Fall 2019 🀨

Lab 3 - Variables, Data Types, and Expressions

Tuesday, Sep. 3rd or Wednesday, Sep. 4th


Objectives of this Lab

  1. Visit the Piazza bulletin board so you know where to post questions,
  2. learn about Java variables and expressions,
  3. understand integer versus floating point math,
  4. see how the order of precedence affects expressions,
  5. find out the difference between println, print, and printf, and
  6. learn how to format output using printf.

Piazza

Your TA will help you navigate to the Piazza website and show you how to post and answer questions. The link for Piazza is in Canvas.

Getting Started

Create a new Java Project named Variables, and make a class named Variables.

Java Variables

Following 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. Think about the above behavior and be prepared to answer the following questions:


  5. Experiment with different print statements, as follows:





CS Banner
CS Building