0
can we use any other word than pionts in the code { in the text }
import java.util.HashMap; public class MyClass { public static void main(String[ ] args) { HashMap<String, Integer> points = new HashMap<String, Integer>(); points.put("Amy", 154); points.put("Dave", 42); points.put("Rob", 733); System.out.println(points.get("Dave")); } } // Outputs 42
1 Answer
+ 1
Yes, points in this code is a variable identifier name. Variable names can be whatever you want within the allowable naming rules. see naming section here https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
So, for instance you could change points to score.