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;
}
全部评论

相关推荐

asdasdasda...:19岁,不容易啊可能升个本会好点,现在学历歧视太严重了
点赞 评论 收藏
分享
05-20 21:57
已编辑
门头沟学院 Java
喜欢吃卤蛋的悲伤蛙在...:建信融通没消息吧,我2说有实习挂简历不理了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务