What does the Java assert keyword do, and when should it be used?

前端 未结 19 1791
眼角桃花
眼角桃花 2020-11-22 15:58

What are some real life examples to understand the key role of assertions?

19条回答
  •  清歌不尽
    2020-11-22 16:10

    Assertion are basically used to debug the application or it is used in replacement of exception handling for some application to check the validity of an application.

    Assertion works at run time. A simple example, that can explain the whole concept very simply, is herein - What does the assert keyword do in Java? (WikiAnswers).

提交回复
热议问题