COMPSCI 121 Lecture 6: Feb 14
Document Summary
Primitive: int, double, boolean, char int 0, 1, 1256 double 1. 3, 5. 987, 3. 00 boolean true false. A reference references or points to a location in memory. String pupname = spot; int len = pupname. length(); // len assigned 4. Two strings set equal to each other will equal the one on the right. String greeting2 = new string howdy; greeting = greeting2 // both assigned howdy greeting. equals(greeting2) tests equality vs. == tests if whole numbers or characters are equal (identity) A package: a bundle of classes with a common gen. purpose, hundreds of standard, can make own java. lang is automatically loaded others are loaded as needed. Scanner class is in package java. util, need to load it in import using: import java. util. scanner; import statements go outside and before class definitions example: // question 3. 5 import statements and scanner import java. util. scanner; public class mytest{ public static void main(string[] args){ Feb 14 page 1 int n; double r; n = console. nextint(); r = console. nextdouble();