192k views
3 votes
printTodaysDate is a method that accepts no arguments and returns no value. Write a statement that calls printTodaysDate. Assume that printTodaysDate is defined in the same class that calls it.

1 Answer

3 votes

Answer:

printTodaysDate( );

Step-by-step explanation:

A method or function is called in programming languages like java by typing the method's name followed by a pair of parenthesis and a semi-colon to end the statement. The parenthesis will contain the parameters if the method accepts argurments when called.

For the example in this question, the method printTodaysDate(), accepts no arguments. It is important also to note that if a method returns a value, then it can be called and assigned to a variable, for example if printTodaysDate were to return a value then it could also have been called like this: todaysDate=printTodaysDate();

User Lmsimp
by
7.3k points