- 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!
推薦閱讀
- Mastering Concurrency Programming with Java 8
- Python概率統計
- JavaScript前端開發模塊化教程
- Objective-C Memory Management Essentials
- Power Up Your PowToon Studio Project
- 軟件工程
- Modular Programming in Java 9
- Learning Concurrency in Kotlin
- Lighttpd源碼分析
- C++20高級編程
- Unity&VR游戲美術設計實戰
- FPGA嵌入式項目開發實戰
- Python預測分析實戰
- ASP.NET開發寶典
- Elasticsearch Blueprints