chapter 3 notes

chapter 3 notes - java.sun.com to access packages. Under...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
java.sun.com to access packages. Under APIs Java standard class library is part of any Java development environment, the classes are not part of the java language but we rely on them heavily. Class String is part of java.lang package. Java.lang is the only package that is automatically imported. Class math is part of java.lang package. Class Random is part of java.util package. Class DecimalFormat is part of java.txt package. Class NumberFormat is part of java.txt package. If you don’t import a package, you can write… import java.util or…. Scan = new java.util.scanner(System.in) but is not preferred. Public class Example { public static void main (String[] args) { String title; title = new String (“Java language is cool!”) String is the class name. Title is the object reference. Instantiating a new object (Title) A method is usually a verb – It returns zero or one value. The first character in a string starts at 0, not 1. A substring – System.out.println (title.substring (3, 30));
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/18/2011 for the course CSE 110 taught by Professor Kim during the Fall '08 term at ASU.

Page1 / 2

chapter 3 notes - java.sun.com to access packages. Under...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online