When to use Long vs long in java?

前端 未结 7 1276
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 13:03

Below is my Interface -

public interface IDBClient {
    public String read(ClientInput input);
}

This is my Implementation of the Interfa

相关标签:
7条回答
  • 2020-12-24 13:47
    1. As Long is wrapper class privimitive type long and Long is a class, which indicate its instance could be null. In my perspective use wrapper class is better than primitive type because there could have null state in it, which could tells us more information.
      In addition, wrapper class will automatically initialized with 0, it is good for lazy using.

    2. For data validation, I think you'd better do it in controller rather than DAO, then have a good method to handle this or alert user to modify them!

    0 讨论(0)
提交回复
热议问题