14.1k views
2 votes
Which method call represents the invocation of a method that does not have arguments?

A. greeting.replace("Hello", "Welcome");
B. ()
C. System.out.println(greeting);
D. None of the above

User Mgus
by
8.0k points

1 Answer

1 vote

Final answer:

The method call without arguments is represented by 'C. System.out.println(greeting);' assuming there is a version of the println method that takes no arguments. Options A and B are not correct because A includes arguments and B does not represent a method call.

Step-by-step explanation:

The method call that represents the invocation of a method without arguments is C. System.out.println(greeting). The println method is being called here with the variable greeting being passed as an argument, implying that there's another form of this method that does not take any arguments. In contrast, option A is incorrect because the replace method is clearly being called with two string arguments, and option B is not a method at all, but rather an empty set of parentheses which by itself does not signify a method invocation.

]

User Nick Sotiros
by
8.6k points