how to get a user to add to an arraylist in java
Java
public class chores {
public static void main(String[] args) {
Boolean close = false;
ArrayList<String> name = new ArrayList();
ArrayList<String> chores = new ArrayList();
Scanner scanner = new Scanner(System.in);
System.out.println("Please enter '0'to exit");
System.out.println("Please enter name: ");
String answer = scanner.nextLine();
if (answer == "0") {
close = true;
System.out.println("Program has been terminated.");
}
else {
name.add(answer);
do {
System.out.println("Please enter chore: ");
answer = scanner.nextLine();
chores.add(answer);
System.out.println("Please enter name: ");
name.add(answer);
}while(answer != "0");
}
}
}
Also in Java:
- Title
- how to take space separated input in java
- Category
- Java
- Title
- java replace all html tags
- Category
- Java
- Title
- print hashtable in java
- Category
- Java
- Title
- java hello world
- Category
- Java
- Title
- convert string to int java
- Category
- Java
- Title
- How to print in console java
- Category
- Java
- Title
- how to add a number to an array in java
- Category
- Java
- Title
- java recursion
- Category
- Java
- Title
- arraylist to array java
- Category
- Java
- Title
- java get annotation value
- Category
- Java
- Title
- import java.util.hashset
- Category
- Java
- Title
- java bigdecimal compareto
- Category
- Java
- Title
- how to create a constructor in java
- Category
- Java
- Title
- para que sirve getcontentpane en java
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- convert char to string java
- Category
- Java
- Title
- random processing
- Category
- Java
- Title
- big integer java
- Category
- Java
- Title
- java map foreach
- Category
- Java
- Title
- java print treemap
- Category
- Java
- Title
- java nextpermutation
- Category
- Java
- Title
- java null pointer exception
- Category
- Java
- Title
- goodbye java
- Category
- Java
- Title
- java hashmap example
- Category
- Java
- Title
- java script how to not allow soace
- Category
- Java
- Title
- create notification android
- Category
- Java
- Title
- Scanner library showing element not found exception
- Category
- Java
- Title
- not equal to java
- Category
- Java
- Title
- Fragment DashboardFragment not associated with a fragment manager.
- Category
- Java
- Title
- check java version cmd
- Category
- Java
- Title
- inheritance in java
- Category
- Java
- Title
- read and write files pattern java
- Category
- Java
- Title
- import
- Category
- Java
- Title
- usaco 2018 january contest
- Category
- Java
- Title
- java delay
- Category
- Java
- Title
- isnumber java
- Category
- Java
- Title
- check if optional is empty java
- Category
- Java
- Title
- java find duplicates in array
- Category
- Java
- Title
- how to byheart faster
- Category
- Java
- Title
- java - get open ports
- Category
- Java
- Title
- alfred workflow
- Category
- Java
- Title
- primitive data types in java
- Category
- Java
- Title
- spigot get player from UUID
- Category
- Java
- Title
- java loop through object
- Category
- Java
- Title
- java get excectuon time
- Category
- Java
- Title
- trees in java
- Category
- Java
- Title
- java script snippet for responsive
- Category
- Java
- Title
- can we overload a static method in java
- Category
- Java
- Title
- string length in java
- Category
- Java
- Title
- selection sort in java
- Category
- Java
- Title
- java vs javascript
- Category
- Java
- Title
- full shutdown windows 10 cmd
- Category
- Java
- Title
- recursive function for fibonacci series in java javascript
- Category
- Java
- Title
- context error in android studio
- Category
- Java
- Title
- how to make a char uppercase in java
- Category
- Java
- Title
- lightweight java game library
- Category
- Java
- Title
- rock paper scissors java
- Category
- Java
- Title
- Create ArrayList from array java
- Category
- Java
- Title
- get long from date java
- Category
- Java
- Title
- how to add java_home in mac
- Category
- Java
- Title
- jackson ignore values if empty
- Category
- Java
- Title
- encode file to utf-8 in java
- Category
- Java
- Title
- java output length of each line in a text document
- Category
- Java
- Title
- from file to array java
- Category
- Java
- Title
- java convert char to int
- Category
- Java
- Title
- how to iterate hashset in java 8
- Category
- Java
- Title
- java making a screen
- Category
- Java
- Title
- abstraction in java
- Category
- Java
- Title
- how to check if in array java
- Category
- Java
- Title
- java remove first character from string
- Category
- Java
- Title
- android how to switch between activities
- Category
- Java
- Title
- java script print date in YYYY-MM-DD HH:MM:SS format
- Category
- Java
- Title
- java pass arraylist by value
- Category
- Java
- Title
- length of string java
- Category
- Java
- Title
- java if different ways
- Category
- Java
- Title
- how to change the color of a menubar in java
- Category
- Java
- Title
- add element to stack java
- Category
- Java
- Title
- java list of a class has a string that is equal to
- Category
- Java
- Title
- java date time
- Category
- Java
- Title
- java lerp
- Category
- Java
- Title
- isSelfDivisor java
- Category
- Java
- Title
- java how to iterate through a arraylist
- Category
- Java
- Title
- array in java
- Category
- Java
- Title
- java while
- Category
- Java
- Title
- append to arraylist by index java
- Category
- Java
- Title
- array rotation program in java
- Category
- Java
- Title
- java boolean zen
- Category
- Java
- Title
- java self signed certificate truststore
- Category
- Java
- Title
- query java persistence
- Category
- Java
- Title
- android studio remove navigation bar
- Category
- Java
- Title
- how to initialize an array in java
- Category
- Java
- Title
- how to import a scanner in java
- Category
- Java
- Title
- initialize arraylist
- Category
- Java
- Title
- java 8 stream group by example
- Category
- Java
- Title
- java how to serialize a file into a local server
- Category
- Java
- Title
- dice in java
- Category
- Java
- Title
- how to add multiple filter condition in Java stream filter chain
- Category
- Java
- Title
- arraylist with values java
- Category
- Java
- Title
- java exceptions for catch
- Category
- Java
- Title
- java arraylist
- Category
- Java