aspose file tools*
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
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: String objects