Skip to main content
12 votes
2 answers
392 views

While upgrading our project from Java 17 to Java 21, we noticed an increase in memory consumption. After dumping the heap and analyzing the differences, I found that there are thousands of empty ...
Voy's user avatar
  • 165
1 vote
3 answers
272 views

Recently I'm learning Hotspot JVM. When learning the string constant pool and String intern function, I encountered a very weird situation. After browsing a lot of answers, I still can’t explain this ...
DracoYu's user avatar
  • 37
2 votes
0 answers
51 views

in addition to the answers provided here For example : q = "asdasdasdsadsadsadsadsadsadsadsadsad" a = "asdasdasdsadsadsadsadsadsadsadsadsad" >>> a is q True even though ...
Spyros Kappalamda's user avatar
-1 votes
3 answers
99 views

String a="hello"; String b=a+"Bye"; How many Strings are formed? From my understanding of Java. What happens in this code is: String a="hello"; // hello is created in ...
Joshua Samuel's user avatar
71 votes
1 answer
2k views

I am learning about reflection in Java. By accident, I discovered the following, for me unexpected behavior. Both tests as written below succeed. class NewInstanceUsingReflection { @Test void ...
hanszt's user avatar
  • 583
1 vote
1 answer
730 views

I have a problem where I'm trying to take the text string string "The quick brown fox jumps over the extraordinarily lazy dog" and convert it into an array of characters whilst also storing ...
Damon O'Neil's user avatar
0 votes
2 answers
188 views

I am currently working on java 8 Project from last 4 years. In an interview, I was being asked what will happen if your String pool is full. Never encountered it. Already searched a lot didnt find any ...
NEHA's user avatar
  • 9
0 votes
2 answers
310 views

Given this example code: class basic { public static void main(String[] args) { String s1 = "Java"; String s2 = new String("Java"); } } Are s1 and s2 both ...
Andrew's user avatar
  • 11
3 votes
2 answers
869 views

I have some questions revolving around the garbage collection of string objects and literals and the string pool. Setup Looking at a code snippet, such as: // (I am using this constructor on purpose) ...
vishal joshi's user avatar
1 vote
1 answer
1k views

I was reading a book on Java and there was an option mentioned to modify the size of the String Pool, and that option was XX:StringTableSize. When I tried this in my command line, I got an error ...
HusenPatel's user avatar
0 votes
1 answer
379 views

I am implementing a cache in Golang. Let's say the cache could be implemented as sync.Map with integer key and value as a struct: type value struct { fileName string functionName string } ...
dhythhsba's user avatar
  • 1,032
3 votes
1 answer
504 views

When creating a String like this: String s1 = “ABC” the JVM will look in the String pool if "ABC" exists there and create a new object only if "ABC" doesn't exist yet. So the ...
Sadık's user avatar
  • 4,449
0 votes
1 answer
467 views

I have so many use cases where I have to initialize a large string and not use the same string anywhere else. //Code-1 public class Engine{ public void run(){ String q = "...
stux_kill's user avatar
  • 620
0 votes
0 answers
73 views

If string pool caches the string values then till what time it keeps values into the memory. When it sends those values to GC. If I send two call request of a same REST web service then Does this two ...
praveen kumar's user avatar
2 votes
1 answer
193 views

13: String a = ""; 14: a += 2; 15: a += 'c'; 16: a += false; 17: if ( a == "2cfalse") System.out.println("=="); 18: if ( a.equals("2cfalse")) System.out....
S. Tiss's user avatar
  • 319

15 30 50 per page
1
2 3 4 5
9