forked from ShiftLeftSecurity/shiftleft-java-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuilder.java
More file actions
32 lines (29 loc) · 715 Bytes
/
Builder.java
File metadata and controls
32 lines (29 loc) · 715 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
public class Builder
{
Builder() {}
public static void main(String[] args)
{
System.out.println("Please enter how many widgets to create:");
final String input = System.console().readLine();
final int i = Integer.parseInt(input);
buildList(i);
}
private static void buildList( int size)
{
Widget[] list = new Widget[size];
for (int i = 0; i < size; i++)
{
//Create new widget
list[i] = new Widget();
//Inform user
System.out.println(String.format("New widget [%d]:",i) + list[i]);
}
}
}
class Widget
{
Widget()
{
// System.out.println("Widget created");
}
}