CC2203-les05javaV-for-viewing

CC2203-les05javaV-for-viewing - 5-1/15Lesson 5: Java V –...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 5-1/15Lesson 5: Java V – Strings, Wrapper Classes and RecursionAfter completing this lesson, you should be able to do the following:•Create strings in Java•Manipulate string•Use wrapper classes to convert strings to primitives and primitives to strings•Describe Recursion5-2/15What Is a String?•A string is a sequence of characters.•The Stringclass represents all strings in Java.•Stringobjects are read-only; their values cannot be changed after creation.•A Stringis an object.5-3/15How to Create a String•Assign a double-quoted constant to a Stringvariable:•Concatenate other strings:•Use a constructor:String category = "Action";String empName = firstName + " " + lastName; String empName = new String("Joe Smith");[demonstration – javaV.zip]5-4/15How to Concatenate Strings•Use the + operator to concatenate strings:•You can concatenate primitives and strings:•String.concat()is another way to concatenatestrings.System.out.println("Name = " + empName);int age = getAge();System.out.println("Age = " + age);[demonstration – javaV.zip]5-5/15How to Perform Operations on Strings•How to find the length of a string:•How to find the character at a specific index: •How to return a substring of a string:int length();...
View Full Document

Page1 / 15

CC2203-les05javaV-for-viewing - 5-1/15Lesson 5: Java V –...

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

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