wood burning stoves 2.0*
The moose likes Java in General and the fly likes Class Instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Class Instance" Watch "Class Instance" New topic
Author

Class Instance

Mahtab Alam
Ranch Hand

Joined: Mar 28, 2012
Posts: 319

what is the difference between these two

String s=new String("vbnm");

Class c=Class.forName("java.lang.String");

what this means is class instance
Isn`t a class instance is an object

Please explain in detail


http://www.mahtabalam.net , Oracle Java Programmer , Oracle SQL Expert , Oracle Java Web Component Developer
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Mahtab Alam wrote:what is the difference between these two

String s=new String("vbnm");

Class c=Class.forName("java.lang.String");


The first line creates a new String object--an instance of the java.lang.String class.

The second line creates or retrieves (probably retrieves) a Class object--an instance of the java.lang.Class class.

They both give back an object. The objects are of 2 different classes, and only the first case definitely creates a new object--the second one may or may not, you'd have to check the docs.



what this means is class instance
Isn`t a class instance is an object


I have no idea what you're saying here.

Please explain in detail


Requests like that sound overly demanding and pushy. Anybody who answers here is donating his or her own personal time to do so. They will answer with as much or as little detail as they feel like providing. When you say something like this, it may make people not want to help you at all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class Instance