In Java, the short keyword is used to declared a variable as a numeric type. A short value can hold a 16-bit integer number which ranges from -32,768 to 32,767. For example:

short length = 20120;

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

public short getLength() {
    return 20120;
}

See all keywords in Java.

 

Related Topics:

 

Other Recommended Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.



Add comment