Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Notes on Primarily on Arrays, Array List and String | CSIS 110, Study notes of Javascript programming

Material Type: Notes; Professor: Hanks; Class: Intro to Programming in Java; Subject: Computer Science Info Systems; University: Fort Lewis College; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 08/05/2009

koofers-user-ztv
koofers-user-ztv 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSIS 110 - Lecture 18
Quiz:
Next Friday (October 14) - Primarily on arrays, ArrayLists, and Strings
Strings:
We looked at some String methods:
- length
- equals
- charAt( int index )
- indexOf( char c ), indexOf( char c, int startIndex )
- lastIndexOf( char c ), lastIndexOf( char c, int startIndex )
- substring( int startIndex, int lastIndex ), substring( int startIndex )
- toUpperCase(), toLowerCase()
Let's try some examples:
Count the number of 'A's in a String
Print every other character in a String
Print a String in reverse order
Random Numbers
Open BlueJ. Java contains a class Random – go look it up in the Java documentation.
(Help | Java Class Libraries ).
What package is it contained in? (That is, where do you need to tell Java to look for the
Random class in an import statement?)
How do you create an instance of a Random?
How do you generate a random number?
- create an instance of class Random
- call a method on that object to get a number
Open the RandomExample project (in chapter 5 directory). Go ahead and play around
with it.
What do the methods do?
What is the difference between the two versions of printTenRandoms?
Lab Exercise
See DNAStringLab.doc

Partial preview of the text

Download Notes on Primarily on Arrays, Array List and String | CSIS 110 and more Study notes Javascript programming in PDF only on Docsity!

CSIS 110 - Lecture 18

Quiz: Next Friday (October 14) - Primarily on arrays, ArrayLists, and Strings Strings: We looked at some String methods:

  • length
  • equals
  • charAt( int index )
  • indexOf( char c ), indexOf( char c, int startIndex )
  • lastIndexOf( char c ), lastIndexOf( char c, int startIndex )
  • substring( int startIndex, int lastIndex ), substring( int startIndex )
  • toUpperCase(), toLowerCase() Let's try some examples: Count the number of 'A's in a String Print every other character in a String Print a String in reverse order Random Numbers Open BlueJ. Java contains a class Random – go look it up in the Java documentation. (Help | Java Class Libraries ). What package is it contained in? (That is, where do you need to tell Java to look for the Random class in an import statement?) How do you create an instance of a Random? How do you generate a random number?
  • create an instance of class Random
  • call a method on that object to get a number Open the RandomExample project (in chapter 5 directory). Go ahead and play around with it. What do the methods do? What is the difference between the two versions of printTenRandoms? Lab Exercise See DNAStringLab.doc