Question: Write ( define ) a public static method named longest, that takes two arguments ( all arguments will be Strings ) . When this method

Write (define) a public static method named longest, that takes two arguments (all arguments will be Strings). When this method is called, it should determine which string is longer, and return that string. If both arguments are the same length, then this method should return the first argument string.
Examples:
longest("abc","ab") will return "abc"
longest("hello", "goodbye") will return "goodbye"
longest("thursday","12345678") will return "thursday"
You may wish to write some additional code to test your method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!