Arrays Of Strings
Write a method named find. The method shall take two arguments. And array of strings and a string t, for the target. Your method shall return true if the target t appears in the array, false otherwise. (note you will have to create a new array of strings
class Main {
public static boolean find(String[] myStringArray, String t) {
for (String element:myStringArray ) {
if (element.equals(t)) {
return true;
}
}
return false;
}
public static void main(String[] args)
{
boolean found=find(new String[] {“Car”,”Plane”,”Bike”,”Train”},”Bike”);
if (found) {
System.out.println(“String found”);
} else {
System.out.println(“String not found”);
}
}
}
Place an Order
Plagiarism Free!
Create an Account
Create an account at Top Tutor Online
- Allows you to track orders.
- Receive personal messages.
- Send messages to a tutor.
Post a Question/ Assignment
Post your specific assignment
- Tutors will be notified of your assignment.
- Review your question and include all the details.
- A payment Link will be sent to you.
Wait for your Answer!
Make payment and wait for your answer
- Make payment in accordance with the number of pages to be written.
- Wait for your Answer as a professional works on your paper.
- You will be notified when your Answer is ready.