Download presentation
Presentation is loading. Please wait.
Published byWinifred Reynolds Modified over 8 years ago
1
AP Java Ch. 4 Review 2014-2015
2
Question 1 Java methods can return only primitive types (int, double, boolean, etc).
3
Question 2 All Java classes must contain a main method which is the first method executed when the Java class is called upon.
4
Question 3 Java methods can return more than one item if they are modified with the reserved word continue, as in public continue int foo( ) { … }
5
Question 4 The following method header definition will result in a syntax error: public void aMethod( );
6
Question 5 A method defined in a class can access the class’ instance data without needing to pass them as parameters or declare them as local variables.
7
Question 6 The interface of a class is based on those data instances and methods that are declared public.
8
Question 7 Defining formal parameters requires including each parameters type.
9
Question 8 Every class definition must include a constructor.
10
Question 9 While multiple objects of the same class can exist, there is only one version of the class.
11
Question 10 A constructor must always return an int.
12
Question 11 A class’s instance data are the variables declared in the main method.
13
Question 12 The return statement must be followed a single variable that contains the value to be returned.
14
Question 13 A method defined without a return statement will cause a compile error.
15
Question 14 The println method on System.out is overloaded.
16
Question 15 Method decomposition is the process of creating overloaded versions of a method that do the same thing, but operate on different data types.
17
Question 16 An object may be made up of other objects.
18
Question 17 In a method with both a precondition and a postcondition, the postcondition should be true when the method finishes executing regardless of whether the precondition was true.
19
Question 18 An accessor method provides access to a value and allows the caller to change that value.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.