- Java 11 and 12:New Features
- Mala Gupta
- 56字
- 2021-07-02 12:27:00
Assigning null with explicit casting
Again, although it doesn't make sense to use explicit casting with null to assign it to a var type, it is a valid code, shown as follows:
var name = (String)null; // Code compiles
Though the preceding line of code is correct syntax-wise, it is a bad coding practice. Avoid it!
推薦閱讀
- C++ Primer習(xí)題集(第5版)
- PostgreSQL for Data Architects
- Python語(yǔ)言程序設(shè)計(jì)
- 云原生Spring實(shí)戰(zhàn)
- AngularJS深度剖析與最佳實(shí)踐
- Android Wear Projects
- 利用Python進(jìn)行數(shù)據(jù)分析
- Learning Unreal Engine Android Game Development
- Extending Unity with Editor Scripting
- Natural Language Processing with Python Quick Start Guide
- 工業(yè)機(jī)器人離線編程
- Scratch從入門(mén)到精通
- 零基礎(chǔ)學(xué)C++(升級(jí)版)
- AutoCAD基礎(chǔ)教程
- Android應(yīng)用開(kāi)發(fā)攻略