The last two lectures introduced Boards, Strings and Scanners. Here is a quick run down of what you should know for this lab. You are also expected to understand everything from the previous labs. Please feel free to go back to previous lab and redo parts you had difficultlies with.
public class Example
{
public static void main( String[] args )
{
// Your code here!
}
}
Remember to change the name of the class to match the name of the file you are creating.
.nextLine() and .close.
Refer to documentation for more Scanner methods.
String aString = "My Message";
.charAt(int position), .indexOf(char c), .indexOf(String s), and .substring(int start).
char a = aString.charAt(1); System.out.println(a); // outputs 'y' since 'y' is in the first position //NOTE: Recall that counting starts at 0 (i.e. 'M' is at the 0th position, 'y' is the 1st, etc.)
int x = 5; String s1 = "hello"; String s2 = x + s1; System.out.println(s2); // outputs the string "5hello"
If you do not understand a point above, please consult a tutor, TA or instructor immediately as this will become a critical part of the course.