- Java 11 and 12:New Features
- Mala Gupta
- 115字
- 2021-07-02 12:26:59
Code check – part 1
One of our programmers, Aarav, refactored some code by his team member, Pavni. The code no longer provides char and the corresponding ASCII numbers of the values stored by the char array. Can you help Aarav? The following is the code to use:
class Foo { public static void main(String args[]) { try { char[] name = new char[]{'S','t','r','i','n','g'}; for (var c : name) { System.out.println(c + ":" + (c + 1 - 1)); } } catch (var e) { //code } } }
The answer to the code check: The var type can't be used to specify the types of exceptions in the catch handler, (var e).
推薦閱讀
- Cocos2D-X權威指南(第2版)
- 潮流:UI設計必修課
- Visual FoxPro 程序設計
- BeagleBone Media Center
- 深度強化學習算法與實踐:基于PyTorch的實現
- Securing WebLogic Server 12c
- Instant Nancy Web Development
- Mastering ROS for Robotics Programming
- C++寶典
- Geospatial Development By Example with Python
- Node.js開發指南
- 并行編程方法與優化實踐
- Java Web應用開發給力起飛
- Scala Functional Programming Patterns
- 前端架構設計