TODAY WE WILL ===== * announcements/prep for next class * review clicker questions * Week 2 Lab Exercise * Reading -- for next week: * Chapters 4 and Chapter 5 * HSU Public Service Announcement: * The HSU Add/Drop deadline for Fall 2021 is MONDAY, SEPT 6! * Remember that Homework 1 is due 11:59 pm TONIGHT * Will send class e-mails as parts of Homework 2 become available * MONDAY is the LABOR DAY HOLIDAY - no classes! * our next meeting is next FRIDAY, September 10! * ...in BSS 317! * NOTE that synchronous Zoom will also be available (that is, we're trying HYFLEX!) ======== AFTER-LAB COMMENTS!!! (also sent in class e-mail, and noted as asides in CS 235 - Homework 2 - Problem 5!) ==== IMPORTANT THING 1 - need import statement to use Scanner * Aha -- classes in Java package java.util -- such as Scanner! -- are NOT automatically visible to all Java classes. * To make classes from a Java package available in a Java class, add an import statement *before* the javadoc comment for the class in that file. * we'll discuss the import statement a bit more in class! * In the meantime, to make all of the classes in Java package java.util available to a Java class, you can add this *before* the javadoc comment for the class in that file: import java.util.*; ==== IMPORTANT THING 2 - awkwardness when call Scanner method nextLine after something like nextInt * It appears that the Java Scanner class's nextLine method suffers from a similar issue as the C++ getline function...! * That is, in C++, if you do interactive input using cin >> and then want to use getline to read in an entered line of input as a string, you need to add an additional getline to "get past" the previous cin >>'s enter/newline. * It appears that, in Java, using a Scanner object with System.in, if you use something like one of the Scanner methods nextInt or nextDouble and then want to use method nextLine to read in an entered line of input as a string, you likewise need to add an additional call of method nextLine to "get past" the previous entry's enter/newline! * Now, as in C++, if you don't HAVE any calls to methods such as nextInt or nextDouble before calls to nextLine, there is no such issue, and the interactive input of lines of input goes like you'd expect! * Adding an extra call to Scanner method getline should solve the issue we ran into in the Week 2 Lab Exercise, at the end of Problem 1. (please let me know if you have any questions about the above!)