Is String a primitive or an Object in Android or Java?

后端 未结 6 1355
無奈伤痛
無奈伤痛 2020-12-14 18:12

In the Android API http://developer.android.com/guide/topics/data/data-storage.html#pref

It says:

Shared Preference allows you to save and re

6条回答
  •  感情败类
    2020-12-14 18:35

    As far as Java programming language is considered,

    A primitive type is predefined by the language and is named by a reserved keyword.

    In addition to the eight primitive data types listed above, the Java programming language also provides special support for character strings via the java.lang.String class.

    —— from The Java™ Tutorials - Primitive Data Types

    So, as such in Java books, it's not a keyword and not a primitive either. SharedPreferences may still call it one of the primitives, but that's not from the book of Java as such, it could be because it's one of the set of basic types like int, float, char etc we come across.

提交回复
热议问题