Assignment05 - the number of bounces whereas HashMap can...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
5.25 – public void enterNumber(String name, String number){ String newName = name; String newNumber = number; MapTester.put(name, number); } public String lookUpNumber(String name){ String getName = name; String number = MapTester.get(getName); System.out.println(number); } 5.26 – The key that was added last is the one that is final/will be used. 5.28 – You can have a Class.get(keyName) method to check whether or not the key exists, if a value is returned related to the input, then the key does exist. 5.29 – null is returned 5.32 – A HashSet is like an ArrayList because both are extensions to a function, they hold more than one value, they both use strings, and they use the add method. They are different only in their behaviors when used. 5.34 – By telling split to add a space after the input of a user. Search and locate all :’s inside of a string and replace them with a space.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
5.53 – ArrayList, because ArrayLists and HashSets only need to store one variable, in this case
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the number of bounces, whereas HashMap can store multiple. ArrayList takes priority over HashSets because unlike sets ArrayLists keep the input placed in order. 5.58 – public final int tolerance = .001; private final int PassMark = 40; public final String help = “h”; 5.62 – The method does not work because the s String is being upper cased, but not stored as such. Another string needs to be created in order to hold the changes made to s. public void printUpper(String s) { String newString = s.toUpperCase(); System.out,println(newString); } 5.63 – When i1 is set to equal i2 the way it was (i1 = i2), the meaning of this is that i1 will always equal what i2 does in that particular parameter or method. Because of this, when i2 is changed on the next line/sequence, i1 is also changed as a result....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern