subject

Write a Java class with the following methods: getArray(int numStrings) is an instance method that takes command line input (use a Scanner's nextLine() method) to create an array of Strings whose length is numStrings and returns a reference to the array. getArray() does not print anything! getLongestString(String[] sArray) is an instance method that returns a reference to the longest String in sArray. getLongestString() does not print anything! main() creates an instance of the class and uses it to call getArray() with the argument 5, keeping a reference to the return value, then sends the array to getLongestString(), and prints the result

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
Which of the following terms refers to a collection of different types of software that share the goal of infiltrating a computer and making it do something? a- malware b- virus c- spyware d- trojan horse
Answers: 2
You know the right answer?
Write a Java class with the following methods: getArray(int numStrings) is an instance method that t...
Questions
question
Mathematics, 14.04.2020 21:18
question
Mathematics, 14.04.2020 21:18
Questions on the website: 13722363