Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created July 14, 2019 11:06
Show Gist options
  • Select an option

  • Save harrisonmalone/7707f2608ad091df74b87d51f9e5b8f8 to your computer and use it in GitHub Desktop.

Select an option

Save harrisonmalone/7707f2608ad091df74b87d51f9e5b8f8 to your computer and use it in GitHub Desktop.
import java.util.*;
public class CreateEmployee {
public static void main(String[] args) {
System.out.println("Enter a number:");
Scanner scanner = new Scanner(System.in);
String userInput = scanner.nextLine();
System.out.println(userInput);
// ArrayList<String> list = new ArrayList<String>();
// list.add("A");
// list.add("B");
// list.add("C");
// System.out.println(list);
ArrayList<String> list = new ArrayList<String>();
String[] items = {"a", "b", "c", "d"};
for(int i = 0; i < items.length; i++){
list.add(items[i]);
}
System.out.println(list);
}
}
public class Employee {
private String name;
public Employee(String name) {
this.name = name;
}
public String toString() {
return "Name: '" + this.name + "'";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment