• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Instance

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic