forked from janbodnar/Java-Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
33 lines (21 loc) · 786 Bytes
/
Application.java
File metadata and controls
33 lines (21 loc) · 786 Bytes
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
package com.zetcode;
import com.zetcode.bag.ColorBag;
public class Application {
public static void main(String[] args) {
var colorBag = new ColorBag();
colorBag.add("red");
colorBag.add("green");
colorBag.add("yellow");
colorBag.add("blue");
colorBag.add("magenta");
colorBag.add("brown");
System.out.printf("The size of the color bag is: %d%n", colorBag.size());
colorBag.remove("magenta");
System.out.printf("The size of the color bag is: %d%n", colorBag.size());
if (colorBag.contains("magenta")) {
System.out.println("Color bag contains magenta color");
} else {
System.out.println("Color bag does not contain magenta color");
}
}
}