wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String objects" Watch "String objects" New topic
Author

String objects

rengarajan vaikuntam
Ranch Hand

Joined: Oct 04, 2004
Posts: 37
Look at this snippet:

String st = new String("JAVA");

How many objects are created and how many reference variables are created?
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
2 Strings. 1 Reference variable.


SCJP Tipline, etc.
rengarajan vaikuntam
Ranch Hand

Joined: Oct 04, 2004
Posts: 37
Thanks corey
so if i have class called MyClass and if i say

MyClass mc = new MyClass();

Here also can i say 2 objects are created one with the keyword new and the other null and one reference variable mc.

thanx.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String objects
 
Similar Threads
How many objects ?
How many objects are created?
String and String Object Problem
How many objects
String