Q1 write the code needed to print all strings that start


Q1. Write the code needed to print all strings that start with the character 'A'. Write the code if: 

  1. The strings are stored in an array list; use any proper name for the array list, and assume that it is already created and filled with the strings. 
  2. The strings are stored in an array; use any proper name for the array, and assume that it is already created and filled with the strings.

Note: for each part, writing a for loop.

Q2. Assume the following intValue class definition:

class intValue{

  int x;

  public void setX(int i){x=i;}

  public int getX(){return x;}

}

Write the code needed to creating an array list of intValue elements, add 5 intValue objects to the array list, and set the value of x of each element to the index of the element. Also print the values of x of all elements on one line with no spaces. Note this means the output of this code is: 01234.

Solution Preview :

Prepared by a verified Expert
Business Management: Q1 write the code needed to print all strings that start
Reference No:- TGS02746164

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)