Strings Flashcards

1
Q

Strings

A
  • can be instantiated in two ways
  • recycled by the JVM instead of creating new ones every time
  • immutable in Java (cannot be change dance they’re created)
  • using the new keyword forces the JVM to create a new object (not recycle)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

API

A

Application Programming Interface

-a library of functions you can use to interact with a program or component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Methods

A
  • string.length()
  • string.toUpperCase()
  • string.toLowerCase()
  • string.indexOf()
  • string.lastIndexOf()
  • string.chart(index)
  • string.equals(string2)
  • -string.equalsIgnorecase(string2))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

StringBuffer

A
  • mutable string object
  • thread-safe
  • slows performance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

StringBuilder

A
  • wrapper for a mutable string
  • not thread-safe
  • You use a StringBuilder when you are not using threads, or are performing thread control safely somewhere else.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly