JAVA STRING Flashcards
In Java, the ____ class is used to
represent a ___________.
String, group of characters
It is one of the most frequently
used classes in Java programming.
Java String or String
When a new ____ is created,
________ is allocated for it.
string, memory
It is created using double quotes and it can store in the String Pool
String Literals
This can be created using the new keyword or concatenation.
Dynamically Constructed Strings
What is String Pool
a special memory area.
What is Heap
general memory area for objects.
The _____ is like a __________ where Java stores data
Heap, large warehouse
What are the two key features of Heap Memory?
Dynamic and Garbage Collection
Java automatically removes unused data to free up memory.
Garbage Collection
A special area within the Heap for storing strings.
String Pool (String Constant Pool)
What is the Purpose of String Pool?
Saves memory by reusing identical strings and it Improves performance by avoiding duplicate data.
Heap is a general memory for _____, ______, and managed by _______.
data, dynamic, garbage collection
String Pool is a ________ for strings, optimized for ______ and ______.
special memory, reuse, efficiency
Strings in Java are _________, meaning their values __________ after creation.
immutable, cannot be changed
This behavior can lead to __________, especially when performing frequent __________.
higher memory usage, string
manipulations
Java’s __________ efficiently manages memory by cleaning up _________.
garbage collector, unused string data
In Java, __________ ensures ________ and ________, especially when multiple parts of a program use the same text.
immutability, predictable, safe behavior
_________ ensures that multiple threads can access shared _____ without causing _____ or _______.
Thread safety, data, errors, corruption
What is race condition?
two threads updating the same data simultaneously.
What is data inconsistency?
threads seeing incorrect or partial data.
What are the use of Single-Thread?
Perform one task at a time and Slower for multiple tasks.
What are the use of Multi-Threaded Programs?
Perform multiple tasks simultaneously. Faster and more efficient.
When to use Single-Thread?
Use single-thread for simple programs