Hi I am new to java have and wondering why is that String is a class and (int,double,etc.)are not.. is there a big different for me they are all the same string read letter int read integer.
-
2It seems that you need to start with a basic Java tutorial, you can start here: http://docs.oracle.com/javase/tutorial/java/ – fmendez Apr 04 '13 at 02:01
-
Well they're not all the same, sorry. – user207421 Apr 04 '13 at 05:45
-
1It's a basic Java question.You should have first done some google search before asking. – Elijah Dayan Mar 16 '16 at 04:58
5 Answers
int, double, etc. are primitive data types and there are equivalent classes for these data types in Java namely Integer, Double, etc. They are known as wrapper classes.
Please read up more on Java wrapper classes.

- 2,618
- 1
- 16
- 16
String is a class because it usually represents a character array in most langauges. And supports its own functions.
Primative types sunch as int, double, etc. have no support for functions and are stored in memory directly, with a size corresponding to it's limits.
Strings have no practical limits.
Consider String class methods, and instance methods, ints, doubles, etc dont have these.

- 6,928
- 2
- 31
- 46
String is an object, it isn't a primitive type at all, just an array of chars.
int, double, char are primitive types, where as String is a Class. There isn't going to be any different for you.

- 959
- 8
- 16
Yes, String is a class and that class contains methods which allow it to be manipulated in many ways. The primitives also have their own classes (called wrapper classes). Which as you know now, allow them too to be manipulated.
One thing to remember is, Java has naming conventions the one applying to your question is, you always name a class with a capital letter.

- 1,318
- 7
- 19