Is there auto type inferring in Java?

后端 未结 6 868
予麋鹿
予麋鹿 2021-01-30 18:54

Is there an auto variable type in Java like you have in C++?

An example:

for ( auto var : object_array)
    std::cout << var <<          


        
6条回答
  •  -上瘾入骨i
    2021-01-30 19:55

    In short, no, there is no auto type. If all you are doing is printing the value though, you could just refer to the value as an Object.

提交回复
热议问题