Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Help coderanch get a
new server
by contributing to the
fundraiser
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Programmer Certification (OCPJP)
Regarding Strings
prarthana reddy
Ranch Hand
Posts: 48
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Please have a look at the following question:
How many
String
objects are created when we run the following code.
String s1,s2,s3,s4;
s1 = "Hello";
s2 = s1;
s3 = s2 + "Pal";
s4 = s3;
can anyone please give me the answer ?
Naina Si
Ranch Hand
Posts: 134
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
two objects
Naseem Khan
Ranch Hand
Posts: 809
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Three objects created here.
"Hello" and "Pal" is created at class load time as they are compile time constants, "HelloPal" at the time of the execution of the class.
Naseem
Asking Smart Questions FAQ
-
How To Put Your Code In Code Tags
cathymala louis
Ranch Hand
Posts: 77
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Three objects created.
1. Hello
2. pal
3. Hello pal
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
question...
please help me
== with Strings is giving a different result
From Velmurugan's Mock Exam
String Objects
More...