-
Notifications
You must be signed in to change notification settings - Fork 0
/
ST02CourseExcerise.java
41 lines (31 loc) · 998 Bytes
/
ST02CourseExcerise.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.ysingh.structure;
import java.util.Arrays;
import java.util.List;
public class ST02CourseExcerise {
public static void main(String args[]) {
List<String> courses = Arrays.asList("Spring", "Spring Boot", "API", "Microservices", "AWS", "PCF", "Azure", "Docker", "Kubernetes");
System.out.println("Print all courses:");
for(String course : courses) {
System.out.println(course);
}
System.out.println();
System.out.println("Print Courses having Spring in it:");
for(String course : courses) {
if(course.contains("Spring")) {
System.out.println(course);
}
}
System.out.println();
System.out.println("Print Courses having name with atleast 4 letters:");
for(String course : courses) {
if(course.length() > 3) {
System.out.println(course);
}
}
System.out.println();
System.out.println("Print Number of Characters for each course:");
for(String course : courses) {
System.out.println(course.length());
}
}
}