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)
2
Q
API
A
Application Programming Interface
-a library of functions you can use to interact with a program or component
3
Q
Methods
A
- string.length()
- string.toUpperCase()
- string.toLowerCase()
- string.indexOf()
- string.lastIndexOf()
- string.chart(index)
- string.equals(string2)
- -string.equalsIgnorecase(string2))
4
Q
StringBuffer
A
- mutable string object
- thread-safe
- slows performance
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.