The new Java shell, jshell, allows tab completion which shows all methods available to a given instance of a class. For example, If I do...
jshell> Integer myInt = 3
myInt ==> 3
jshell> myInt. <<< + TAB >>>
byteValue() compareTo( doubleValue() equals( floatValue()
getClass() hashCode() intValue() longValue() notify()
notifyAll() shortValue() toString() wait(
...I see all of the methods available to an Integer object. How do I see the methods and variables available to the class at large, not just an instance of the class?
An instance of Integer will only show the instance variables and methods [ Oracle ]:
jshell> Integer j = new Integer(3)
j ==> 3
jshell> j.
byteValue() compareTo( doubleValue() equals( floatValue()
getClass() hashCode() intValue() longValue() notify()
notifyAll() shortValue() toString() wait(
...while non-instance methods and variables can be seen by simply refraining from creating an instance:
jshell> Integer.
BYTES MAX_VALUE MIN_VALUE SIZE
TYPE bitCount( class compare(
compareUnsigned( decode( divideUnsigned( getInteger(
hashCode( highestOneBit( lowestOneBit( max(
min( numberOfLeadingZeros( numberOfTrailingZeros( parseInt(
parseUnsignedInt( remainderUnsigned( reverse( reverseBytes(
rotateLeft( rotateRight( signum( sum(
toBinaryString( toHexString( toOctalString( toString(
toUnsignedLong( toUnsignedString( valueOf(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With