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;
}
All Java Keywords
- abstract Java Keyword
- assert Java Keyword
- boolean Java Keyword
- break Java Keyword
- byte Java Keyword
- case Java Keyword
- catch Java Keyword
- char Java Keyword
- class Java Keyword
- continue Java Keyword
- default Java Keyword
- do Java Keyword
- double Java Keyword
- else Java Keyword
- enum Java Keyword
- extends Java Keyword
- final Java Keyword
- finally Java Keyword
- float Java Keyword
- for Java Keyword
- if Java Keyword
- implements Java Keyword
- import Java Keyword
- instanceof Java Keyword
- int Java Keyword
- interface Java Keyword
- long Java Keyword
- native Java Keyword
- new Java Keyword
- package Java Keyword
- private Java Keyword
- protected Java Keyword
- public Java Keyword
- return Java Keyword
- short Java Keyword
- static Java Keyword
- strictfp Java Keyword
- super Java Keyword
- switch Java Keyword
- synchronized Java Keyword
- this Java Keyword
- throw Java Keyword
- throws Java Keyword
- transient Java Keyword
- try Java Keyword
- void Java Keyword
- volatile Java Keyword
- while Java Keyword
Comments
Post a Comment
Leave Comment