Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Java{
- public static void main(String args[]){
- //An array of words
- String[] words = {"Sword","Armor","Boots","Helmet","Saddle"};
- //Loop through array
- for(String word : words){
- //Print every word in the array that starts with "S"
- if(word.startsWith("S")){
- System.out.println(word);
- }
- }
- String[] words2 = {"bob@gmail.com","sally@gmail.com","aurther@yahoo.com","pam@yahoo.com","arnold@msn.com","sal@gmail.com"};
- //Loop through array
- for(String word : words2){
- //Print every email from the array that ends with gmail.com
- if(word.endsWith("gmail.com")){
- System.out.println(word);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement