You should add the static keyword in the place of ? in Line ________ in the following code:

```
1 public class Test {
2 private int age;
3
4 public ? int square(int n) {
5 return n * n;
6 }
7
8 public ? int getAge() {
9 }
10}
```
a. in line 4
b. in line 8
c. in both line 4 and line 8
d. none


a The square method should be static because it does not reference any instance data or invoke any instance method.

Computer Science & Information Technology

You might also like to view...

In the expression

cout << score[i] << endl; i is called the

Computer Science & Information Technology

To sort a list of 1000, selection sort makes about 5,000 key comparisons.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A set of graphic text styles that can be used to make text look like a graphic is ________

A) WordArt B) a floating object C) SmartArt D) an image

Computer Science & Information Technology

A defined set of formatting characteristics, such as font, font size, font color, cell borders, and cell shading.

A. Cell style B. Cell reference C. Cell content

Computer Science & Information Technology