GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes problem with the same data type and class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem with the same data type and class" Watch "problem with the same data type and class" New topic
Author

problem with the same data type and class

harsh garg
Ranch Hand

Joined: Jul 13, 2008
Posts: 33
why String (data type and class) of java have the same name?no other data type like this in java?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

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");


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
GeeCON Prague 2014
 
subject: problem with the same data type and class