多选题
What is the difference between an int and an Integer?
A. Nothing. They are both fully interchangeable.
B. An int is an object and Integer is a primitive. An int is fastest when performing calculations.
C. An int is a primitive and Integer is an object. An int is fastest when performing calculations.
D. This is a trick question. There is no such thing as an Integer.
E. This is a trick question. An Integer can be defined to be anything a developer wants it to be.
A
B
C
D
E
【正确答案】
C
【答案解析】
int是一种基本数据类型,并且基本数据类型在执行运算时速度会更快。Integer是一个对象。大写字母I会帮助区分对象和基本数据类型。A、B、D和E不正确。
提交答案
关闭