When should you make a method private?

What will be an ideal response?


Make a method private if you don’t think other classes need access to it.

Computer Science & Information Technology

You might also like to view...

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

1. Pseudocode is a special form of machine language produced by the C compiler. 2. Program readability can be improved by indenting both the true and false tasks of all if-else statements. 3. An algorithm should be carefully hand traced before it is implemented in C.

Computer Science & Information Technology

If data in the main program is needed by a subprogram, the value of that data is passed to, or __________ by, the subprogram.

Fill in the blank(s) with correct word

Computer Science & Information Technology

Jodi is new to Java generics. She has proposed the following method. Will it work? If not, what has to be changed to make it work?

``` 1 // method to compute total perimeter of a collection of Shapes 2 public double totalPerimeter( Collection c ) { 3 double total = 0.0; 4 5 for( Shape s : c ) 6 total = total + s.getPerimeter(); 7 return total; 8 } ```

Computer Science & Information Technology

Limiting the amount of content shown by default and making related information available if a user requests it is sometimes called responsive content. _________________________

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

Computer Science & Information Technology