COMPSCI 121 Lecture 6: Feb 14

43 views2 pages

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();

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents