1. An object?s behavior refers to what the object can do (or what can be done to it) and is defined by __________.
2. A "static" object is unique; it belongs to the class rather than the instance of the class. In other words, _____________________________.
3. A bookstore is working on an on-line ordering system. Read the below and decide which option would be most suitable.
For the online ordering system, for each type of published material
(books, movies, audio tapes) they need to track the id, title,
author(s), date published, and price.
Which option would you recommend?
#1: Create one class PublishedMaterial that holds all the information.
#2: Create three classes Book, Movie, and AudioTape that holds the
necessary information in each individual class.
#3: Create one class BookStore that holds all the information.
#4: Create the class PublishedMaterial and have 3 other classes Book,
Movie, and AudioTape inherit fields such as id, title, authors(s), etc.
#5: Create separate classes PublishedMaterial, Books, Movies, AudioTape,
Title, Price, ID, Authors, and DatePublished.
Option 1 and 2 are similar and could both be used
Option 3 would allow for the most complex, and therefore the best, solution
Option 2 and 5 would be best (either of them)
Option 4 would present the most elegant solution
4. Procedural abstraction allows a programmer to use a method by knowing what the method does even if they do not know how the method was?written
5. _________ methods are called through objects of the class. The dot operator is used along with the object name to call _________ methods.
6. ________ methods do not have return values and are therefore not called as part of an expression.
7. Using a ____________ to call a method or access an instance variable causes a NullPointerException to be thrown.
8. A parameter is a value that is sent to a ______ when it is called.
9. The parameter _________ is used by a caller to send a value to the method. This is called passing a value into the method.
10. Refer to the previous question's code as well as the code to follow. True or False?The instance variable 'balance' of the object will hold its value permanently.
11. Referring to the above code snippets, the the parameter 'amount' will hold its value permanently.
12. Is this toString() method correct?
13. What is the output of the following code?
14. Which statement is TRUE of the following code snippet?
15. Call to a void method must be a statement i.e. methodRankPoints(255.7); the above code will produce the following output:
16. Parameters can be passed by _____ or by reference. Passing Parameters by ______ means calling a method with a parameter.
Note: Through this, the argument value is passed to the parameter.
17. The following example shows an example of passing a parameter by reference.
18. When a class has two or more methods by the same name but different parameters, it is known as method ___________.
19. Which one of these is a valid method declaration?
20. Consider the following data field and method. Which of the following best describes the contents of myStuff in terms of m and n after the following statement has been executed?
21. Referring to the code below, what will be printed when the main method is executed?
22. Fill in the blanks for the paragraph below.
23. Using camelcase is the standard convention for creating methods and variable names, but the Java compiler doesn?t enforce this convention
24. _________ are methods with the same name as their class. _____________ are invoked using the new keyword. Example shown below.
public class myClass{
// a constructor that takes one parameter
public myClass(int var){
}
}
25. Type the word that the following sentence is describing: A keyword used in method declarations to specify that the method does not return any value.