Java API Reference Comments

Comments

  • I'm trying to wrap my head around the code lines 11-14. Line 6 is a constructor, which defines attributes of an instance of the StringSample class. (I think this language is correct...). Then there are four print commands; will those be run whenever an instances of StringSample is created? Is that all there is to it?

    cont...
  • Right, the StringSample constructor initializes 2 String instance variables, and it then calls print on 4 different methods. A constructor is just a method that runs when an object instance is

    cont...
  • I had 3 "red" results on the right. Couldn't understand it until I saw line 49....commented 49 out and I am left with 1 red box.. Now I still have the 1 red box and tbh I'm quite sure I did this one right.

    Can you tell me what's wrong?

  • GREEN : [apple, banana, cantaloupe, date, eggplant] RED: [apple, banana, canataloupe, date, eggplant]
    

    5th test box on the right

  • Check that you filled in each TODO correctly. You can view a correct solution here.

  • HI I ran this in eclipse and am getting the same output as here...
    HashMap map;
    map = new HashMap();

        map.put("user", "pass");
    
    cont...
  • It looks like it could print the items inside the hashmap in a different order (this is because HashMaps do not preserve the order of the elements). I simplified the problem so the correct solution

    cont...
  • I'm having trouble with this exercise - I get the correct output which is highlighted in green but the final line where it says "All Your Output" is highlighted in red. I'm assuming the problem is with the 3rd part - my code for that is as follows:
    n = in.nextInt();

    cont...
  • @Victoria, you need to print it with an exclamation point at the end.

  • Please give the answer, as i cannot find out what ive been doing wrong

Contact Us
Sign in or email us at [email protected]