Skip to content

Turning in what I have#22

Open
Z1springer wants to merge 7 commits intoauberonedu:mainfrom
Z1springer:main
Open

Turning in what I have#22
Z1springer wants to merge 7 commits intoauberonedu:mainfrom
Z1springer:main

Conversation

@Z1springer
Copy link
Copy Markdown

I am hoping to finish the rest of the assignment sometime tomorrow. Hopefully before class

Comment thread src/ListPractice.java
public static void main(String[] args) {
// Create an empty ArrayList of Strings and assign it to a variable of type List

ArrayList<String> stringList = new ArrayList<>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types (List)

Copy link
Copy Markdown
Owner

@auberonedu auberonedu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! See comments below

Comment thread src/MapPractice.java
// Create a HashMap with String keys and Integer values and
// assign it to a variable of type Map

HashMap<String, Integer> stringMap = new HashMap<>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types (Map)

Comment thread src/MapPractice.java
Comment on lines +28 to +32
System.out.println("The Keys of the Map are: " + stringMap.keySet());
// Iterate over the values of the map, printing each value

System.out.println("The Values within the Map are: " + stringMap.values());
// Iterate over the entries in the map, printing each key and value

System.out.println("The Key-Value Pairs are: " + stringMap.entrySet());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to practice doing a loop over these sets.

Comment thread src/Person.java
Comment on lines +9 to +10
String publicName;
private int privAge;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to put public before public variables and methods, otherwise they get package visibility by default.

Comment thread src/Person.java
Comment on lines +39 to +41
int birthYear = currentYear - privAge;

return birthYear;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider simplifying this to a single line

Comment thread src/SetPractice.java
public static void main(String[] args) {
// Create a HashSet of Strings and assign it to a variable of type Set

HashSet<String> stringSet = new HashSet<>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types (Set)

Comment thread src/StringPractice.java
}
// Create an ArrayList of Strings and assign it to a variable

ArrayList<String> stringList = new ArrayList<>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types (List)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants