CSU Banner

CS 163/164, Spring 2018

Lab 3 - Variables, Data Types, and Expressions

Tuesday, Jan. 23rd or Wednesday, Jan. 24th


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 on the syllabus and here.

Getting Started

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

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