Computer Science, asked by ghjtej, 16 days ago

in JAVA Write a program to accept names from the user, print all the names which have the surname "Patel" in it.

Answers

Answered by samarthkrv
1

Answer:

public class Main

{

public static void main(String[] args) {

    String[] arr = {"Sujay patel" , "samarth sharma" , "venka patel"};

        for(int i = 0; i < 3; i++){

            if(arr[i].endsWith("patel")){

                System.out.println(arr[i]);

            }

        }

 System.out.println("Hello World");

}

}

Explanation:

Similar questions