Additional variables and data types

On slide 16, we saw how to assign values to a variable of type String. Add to this example variables of type:

  1. double
  2. boolean
  3. int

assign values to them, and print them. For example, adding a boolean variable may look as follows:

class Hello4 {
  public static void main(String[] arguments) {
    String foo = "CST 1201";
    foo = "Something else";
    boolean isCold = false;
    isCold = true;

Upload your file to this assignment prior to the deadline. Please format your code prior to submission (make sure that all the statements line up and are indented properly; see the Java Language Coding Guidelines for more details). If you need help finding your file, please view the following YouTube video:

This material was created by Raffi Khatchadourian and published freely under a Creative Commons Attribution 4.0 license.