Incompatible types : Object cant not be converted to String in java netbeans

前端 未结 3 756
余生分开走
余生分开走 2021-01-29 15:56

I\'m trying to use object Array in my project and i get an error :

incompatible types: Object cannot be converted to String

on this line :

3条回答
  •  死守一世寂寞
    2021-01-29 16:33

    A String is an Object, but an Object is not necessarily a String.

    You try to use variables which are Objects where the compiler expects Strings, and the compiler tells you so. Perhaps the emt1, emt2, emt3 and emt4 variables should have been declared as String? (Hard to tell from the snippet given).

提交回复
热议问题