short_Keyword

short Java Keyword with Examples

Key points about short Java Keyword

  • The short keyword is used to declare a variable as a numeric type.
  • short is a signed 16-bit type.
  • It has a range from –32,768 to 32,767.
  • The Short class is a wrapper class for the short primitive type. It defines MIN_VALUE and MAX_VALUE constants representing the range of values for this type.

short Java Keyword Example

Here are some examples of short variable declarations:

short s;
short t;

Here are some examples of short variable declaration and initialization:

short length = 20120;
short flag = 10;

The short keyword can be used to the declared return type of a method as well:

public short getLength() {
    return 20;
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
11-21 17:16
科大讯飞 算法工程师 28.0k*14.0, 百分之三十是绩效,惯例只发0.9
点赞 评论 收藏
分享
10-24 11:10
山西大学 Java
若梦难了:哥们,面试挂是很正常的。我大中厂终面挂,加起来快10次了,继续努力吧。
点赞 评论 收藏
分享
Hello_WordN:咱就是说,除了生命其他都是小事,希望面试官平安,希望各位平时也多注意安全
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务