Java EnumMap get() methodThe get() method of Java EnumMap class is used to get the mapped value of the specified key. SyntaxParameterskey - the key whose associated value is to be returned ReturnsThis method returns the value to which the specified key is mapped.
ExceptionNA Example 1Test it NowOutput: Map: {CSS=1, Python=2, PHP=3, Java=4} Tutorial.CSS value: 1 Tutorial.Javascript value: null Example 2Test it NowOutput: Map: {Monday=1, Tuesday=2, Wednesday=3} Days.Monday value: 1 Days.Thursday value: null Example 3Test it NowOutput: Map: {January=1, February=2, March=3, April=4} Months.March value: 3 Months.May value: null
Next TopicJava EnumMap
|