How to write Java function that returns values of multiple data types?

后端 未结 11 1560
耶瑟儿~
耶瑟儿~ 2021-01-03 23:34

For example, I want to create a function that can return any number (negative, zero, or positive).

However, based on certain exceptions, I\'d like the function to re

11条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 23:50

    inout parameters only work for objects that can be mutated. For String inout parameters, pass in StringBuilders instead of Strings, then replace() their values.

提交回复
热议问题