How to take input from user and store it in array until the user enters a specific word - java

I want to create a 2D array with the help of user input but the user do not specifies the length of the array. The input taken from the user should be saved in a 2D array. until the user inputs "FINISH".
I tried using ArrayList but thats too compliciated. Any simple logic to make things work?

Related

Changing a variable for each user

Quick question!
I have a arraylist made in my MainActivity.java, and everytime a person puts in a String in a certain place, that String is added into that arraylist. Now what my question is, does that arraylist update for every user using the app or does it change only for the user that put in the String?
If it's the first one, then how can I make it so that the arraylist updates for every user that has the app downloaded?

Accessing and writing 3D array in Java, Android

My program needs to work with 3 dimensional arrays. It has a menu where I can choose between the top level of the array and the next two levels are loaded in based on what the user chooses. All levels must be editable too.
The structure:
Top-level: Array[this][][]
This is where the user chooses an element of the array. In this case I am working on a workout app and the user chooses which workout he/she wants to do.
Second-level: Array[][this][]
There are always 4 elements to this level. The workout name, the duration or count of the exercise types, the set values (100 pushups in 40-30-30 sets) and the resting time between sets.
Third-level: Array[][][this]
The values.
What would the best way be to go about doing this?

Java - Capture value from text box, store in array and return max value in an output field

So I have been asked to help my friend with a small java project, I have a decent enough idea about programming from using VBA but not enough to help him, Im not too clued up on Java
Basically, he has a form with a text box, 2 buttons and an output field
The text box is for entering a value - when he clicks one button, it has to store the value within the text box to an array - and the other button is to output the max value within the array - I would appreciate any help with this if possible
Many thanks,
Sean
To me it sounds like homework. Since you didn't bother posting any code you have written yourself I will outline what I would do. You could use the getText() from a JTextField and store the output in a String. Then you could split that string by white space, provided it only contains integers. After this I would call the Integer.parseInt() method while iterating over the array. Be careful as the input in the box must be only integers, otherwise your program will throw exceptions.

Appending textbox values to Array list

In my java eclipse program i need to fill a array list of string with staff names. So in the GUI I have text-box for the user to enter the name and can press enter so the value goes to the array list.
But now I have a doubt. If I close the program and again run will the new staff names gets appended to the same old array list or will it be a new one.
Assuming that you don't do anything to save it and reload it (to a file, database, or elsewhere), it will be a new one.

Fetching all input textbox id's of a webpage in an array using java

How can I fetch all the id's of all the input text boxes in a particular webpage in an array.
For eg: I have a simple webpage which has around 5 input text boxes. I want to fetch all the id's of those input text boxes in a array of Strings.

Categories