/* 9/24/2019 * your name * CISC 1115 * Data in a program * variables are used to represent data * you must specify the type of a variable * ex: * int -- integer ..., -1, 0, 1, 2, ... * double -- this kind of number can have a decimal point * ex: 5.67, .001 etc * * Variables must be DECLARED * e.g. int number; is a variable declaration * name of a variable is an IDENTIFIER (letters, numbers, _, no spaces) * * Compiler error to have an UNINITIALIZED VARIABLE * Assignment operator = * put whatever is on the right into the left (lvalue) */ public class Variables { public static void main(String[] args) { int number=0; System.out.println(number); number=100; System.out.println("Now number=" + number); // 100=number; NO GOOD // number = "5"; int itemsOrdered; itemsOrdered=3; int quantityOnHand=300; System.out.println("You ordered: " +itemsOrdered + " items," + " we have " + quantityOnHand + " items left."); // exampe of double variable double price=32.5; } }