Arrays and ArrayLists often are used by programmers to store information such as integers, strings, and objects. While these two data structures are similar, there are important differences between them. As you studied, arrays handle primitive data types such as those used in Java programming. The arrays have a constant amount of memory allotted to them, whereas ArrayLists permit you to add, retrieve, and remove elements of different data types within the same structure. This allows for a dynamic array size, as well as the flexibility to combine different data types that have relationships. With these differences in mind, consider scenarios where you might select one over the other to use when programming.
For this Discussion:
Describe a realistic programming scenario that could be solved with the application of either an array or an ArrayList. Explain which solution is better, either an array or an ArrayList, for the particular programming scenario that you have chosen and why.
Do the following:
Ask a probing question.
Offer and support an opinion.
Validate an idea with your own experience.
Make a suggestion.
Discussion 2: Exception Errors
Understanding errors that can occur during computer programming is an essential programming skill. In terms of programming, exception errors are unexpected output produced by a program. These exception errors occur during runtime, often disrupting computer programs and, in some instances, causing programs to crash. While exception error messages produced by a compiler can save time in finding issues, you must still be able to understand the exception error and correct the issue.
For this Discussion:
Select a Java program that contains an exception error. The exception error can be one that you have encountered yourself or one you located using the Internet. Describe your chosen exception error and explain potential implications.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.Discussion 1
• Realistic programming scenario
o I want to store the grade of all assignments, homework in the course
o I want to calculate the average of these grade at the end of term
o I could use both ArrayList and array in this case
• Better solution
o If the number of assignment is unknown, ArrayList is the best choice because we could add as many grades as we want, ArrayList is dynamically resizalible
o If the number of assignment is fixed, array is better because the time to access particular grade value in the array is O(1) “instant”, we also reduce the amount of memory space that is used in the program...