REVIEW QUESTIONS FOR FINAL EXAM 1. Explain the differences of each triple of reserved words or symbols: () [] {} = == equals + ++ += import extends implements 2. Name all of the primitive datatypes that you know. 3. What is the symbol for mod? 4. What is the symbol for not equals? 5. Name all of the String methods that you can. 6. Name all of the JTextBox methods that you can. 7. Rewrite as a one line statement: if (x > y) f = true; else f = false; 8. Write a Java statement that prints the last command line argument. 9. Write a Java main method that prints the first line of each of the following files: file1.txt, file2.txt, file3.txt, ... , file99.txt, file100.txt. 10. Print a table of the ascii codes of these integers: 32, 33, ... , 126, 127. 11. How can you make a data member read only? 12. How can you make a data member write once? 13. Create an array containing the odd integers between 0 and 100 in sequence. 14. What is an inner class? 15. Name the steps to creating a user interface. 16. A user interface has an array t of 20 textfields. Write an actionPerformed method that copies * into t[0], ** into t[1], ***, into t[2], ... , and ******************** (20 stars) into t[19]. 17. A user interface has an array t of textfields and another textfield called ave. Write an actionPerformed method that copies the average length of the strings in the array t into ave. 18. A user interface has an array b of 20 buttons and a textfield t. Write an actionPerformed method that copies the index of the button that was clicked into t. 19. The text file c:\Words.txt contains one word per line. Write a main method that loads the words into the String array a of size 200. Keep track of how many words were loaded in the variable nWords. 20. Write a main method that will write the words in a String array out to the output file c:\Words.txt. 21. How does the BufferedReader signal the program that it is at the end of the file? 22. Write a Java application that inputs the name of a text file and outputs the number of words in the file. Assume there is exactly one blank between each pair of consecutive words in a line. 23. What is the output? Draw the object diagram. public class A { private int s; public A(int anS) { s = anS + 56; } public void magnify(int u) { s *= u; } public int getHalfS() { return s / 2; } } public class Main { int i; A[] x = new A[4]; x[0] = new A(5); x[3] = new A(7); x[1] = x[3]; x[2] = x[0]; x[3].magnify(3); x[0].magnify(2); for(i = 0; i <= 3; i++) System.out.println(x[i].getHalfS()); }