add the static keyword in the place of ? if appropriate. public class test { int count; public ? void main(string[] args) { ... } public ? int getcount() { return count; } public ? int factorial(int n) { int result



Answer :

The common property shared by all objects can be referred to by the static variable (which is not unique for each object).

What does static keyword means?

The Java programming language's static keyword designates a member as belonging to the type itself, as opposed to an instance of that type. This indicates that since the static member is shared by all instances of the class, we'll only construct one instance of it.

The common characteristic shared by all objects, which is not specific to each object, can be referred to by the static variable, for instance, the name of the employer for employees, the name of the college for students, etc. When the class is loaded, the static variable only receives one memory allocation in the class area.

Java uses static keywords frequently because of its effective memory management system. The general rule is that you must first build an instance or object of a class in order to access variables or methods contained within it.

The complete question is:

Add the static keyword in the place of ? if appropriate.

public class Test {

int count;

public ? void main(String[] args) {

...

}

public ? int getCount() {

return count;

}

public ? int factorial(int n) {

int result = 1;

for (int i = 1; i <= n; i++)

result *= i;

return result;

}

}

Therefore, the answer is because the factorial method and the main method don't need to reference any instance objects or use any instance methods in the Test class, add static to both of those methods.

To learn more about static keyword refer to:

https://brainly.com/question/30032860

#SPJ4

Other Questions