65.4k views
0 votes
Consider the following code: // Merge mailing list m2 into m1 void merge (MailingList m1, MailingList m2) { for (int i = 0; i < m2.numEntries(); ++i) m1.add (m2.getEntry(i)); } The programmers who first encountered this code fragment weren’t sure if it was in C++ or Java. In fact, with the addition of some appropriate declarations, it would probably compile correctly in either language. Which language is it? Explain your answer.

User Kendaleiv
by
4.1k points

1 Answer

5 votes

Answer:

That is a Java language

Step-by-step explanation:

This is simply Because C++ language does not support the calling of the methods without parameters and with the .(dot) operator.

It can also be clearly noted that This is the functionality of Java, for example, to sort we call Array.Sort().

So the parameter here is passed by placing the variable at front with the . (dot).

User ChuchaC
by
4.1k points