Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with the same data type and class

 
harsh garg
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why String (data type and class) of java have the same name?no other data type like this in java?
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String is not a datatype. It's just a class. It just have some special treatment by the compiler because of which you can write this

String s = "Hello World";

The compiler internally converts this into

String s = new String("Hello World");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic