Why do Java local variables need to be initialized?
巴扎黑
巴扎黑 2017-05-17 09:58:02
0
2
559

Why do Java local variables need to be initialized? As mentioned. Thanks.

巴扎黑
巴扎黑

reply all(2)
黄舟
  1. The compiler cannot pass

  2. If there is no initialization, just point to an address similar to c. So the direct compilation of java failed.

小葫芦

Compared with global variables, local variables have a short life cycle and are declared many times. If an initial value is given like a global variable, it will affect performance. Not giving an initial value is unsafe, so we made a compromise and stipulated that users need to first Assign value and use again.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!