1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lisabon 2012 [21]
3 years ago
8

The ArrayList class ____ method returns the current ArrayList size.

Computers and Technology
1 answer:
timurjin [86]3 years ago
3 0

Answer:

b. size

Explanation:

We can use the size() method of java.util.ArrayList to determine the size of an  ArrayList in Java. The size() method of the ArrayList class returns an integer which is equal to the number of elements present in the ArrayList.

Below is an example code to illustrate the use of the size() method of the ArrayList:-

     ArrayList<Integer> aList = new ArrayList<Integer>(5);

      aList.add(25);

     aList.add(2);

     aList.add(5);

     aList.add(22);

     System.out.println("Size of the array list: " + aList.size());

This will print the size of the array list as 4 since we've added four numbers into the array list.

You might be interested in
Which of the following is a method to create a new table in Access?
netineya [11]
Create table wizard !
6 0
3 years ago
You'd like to change the minimum password length policy in the default domain policy group policy preference (gpo). What's the b
Naya [18.7K]

The best way to change the minimum password length policy is to open the Group Policy Management Console by running gpmc.msc from CLI.

<h3>What is a password policy?</h3>

A password policy refers to a set of rules and standard that are designed and developed by the data security of an organization, so as to enhance computer security and ensure all password meet the minimum requirements such as:

  • Password length
  • Password maximum age.
  • Password combination

In this scenario, the best way to change the minimum password length policy is to open the Group Policy Management Console by running gpmc.msc from CLI.

Read more on password here: brainly.com/question/3404286

#SPJ12

8 0
2 years ago
Your program is going to compare the scores of two volleyball teams that play each other. To win a match in volleyball, a team m
Alenkasestr [34]

Answer:

#section 1

team1=0

team2=0

matches=[1,2,3,4,5]

for i in matches:

   print("For Game ", i)

#section 2

   while True:

       try:

           scoreA = int(input("Enter score for first team: "))

           scoreB = int(input("Enter score for second team: "))

       

           if scoreA < 25 and scoreB < 25:

               raise ValueError

           try:

               if abs(scoreA - scoreB) < 2:

                   raise  

               else:

                   break

           except:

               print("difference less than 2")

   

       except ValueError:

           print("Enter correct scores")

#section 3

       print("For Game ", i)

   if scoreA > scoreB:

       team1 = team1 + 1

   else:

       team2 = team2 + 1

#section 4

if team2 > team1:

   print("Team 2 is the winner")

else:

   print("Team 1 is the winner")

Explanation:

There is no way you can run the code without using a break statement because, in a while loop you have to pass an argument that will exit the loop. if you don't your loop will keep running and that's not good.

You might have also gone about it in a way that is a bit complicated. when writing code always look out for ways to make your work easier.

I used a For Loop, While Loop and an array.

#section 1

team1=0  

team2=0  

matches=[1,2,3,4,5]  

for i in matches:  

print("For Game ", i)  

- In this section two variables were declared two variables to hold the final results after both teams have played their 5 games and their scores recorded

- An Array holding the number of games they're to play was also declared. they are playing 5 so the Array "matches" holds 5 elements.

- The first loop here is the "For loop" and what it does is to run the block of code under it for all the elements in the Array.

- finally we print for game "i" where i is each game in the array

#section 2

 while True:

       try:

           scoreA = int(input("Enter score for first team: "))

           scoreB = int(input("Enter score for second team: "))

       

           if scoreA < 25 and scoreB < 25:

               raise ValueError

           try:

               if abs(scoreA - scoreB) < 2:

                   raise  

               else:

                   break

           except:

               print("difference less than 2")

   

       except ValueError:

           print("Enter correct scores")

- A while loop is always true unless it encounters an argument that is not true or a break statement is inserted.

- This section is responsible for taking all the inputs required and if a wrong input is entered it would show the specific error and ask you to make the input again.

- Here the Try and Except is use to handle the errors. When the Try block encounters an error it goes to the Except block and executes whatever it finds there.

- The first try block prompts and takes inputs, it then checks if the values inputted satisfies or violates the 25-point rule.

If it does not satisfy the 25-point rule, it goes to it's error block and prints "enter correct score" and the WHILE loop runs again.

within this Try block is nested another try block. if the first try block does not raise any error it proceeds to the second try block.

- The second Try block checks the difference between the scores and if it is less than 2, it raises an error and prints difference is less than 2 and runs the WHILE loop again.

- If there are no errors it BREAKS out of the WHILE loop then the FOR loop moves to the next match.

#section 3

       print("For Game ", i)

   if scoreA > scoreB:

       team1 = team1 + 1

   else:

       team2 = team2 + 1

- Remember there is still a for loop. This section prints the game we just recorded, and checks which team won. It then adds the win as a point(1) to the teams total score.

#section 4

if team2 > team1:

   print("Team 2 is the winner")

else:

   print("Team 1 is the winner")

- In this section the For Loop has finished running and the final values are ready, it compares the scores of both teams and declares the winner.

I have placed an attachment to help you see the code in action.

5 0
3 years ago
What is the group scope for domain admins, domain controllers, and domain users default groups?
Igoryamba
The group of domain admins, domain controllers, and domain users default group is global. Thank you for posting your question here at brainly. I hope the answer will help you. Feel free to ask more questions.
4 0
3 years ago
Clicking the _____ opens the insert function dialog box shown in the accompanying figure.
stiks02 [169]
Clicking the insert function box on the formula bar <span>opens the insert function dialog box shown in the accompanying figure.</span>
8 0
3 years ago
Other questions:
  • SubVIs...
    15·1 answer
  • What is the value of the variable result after these lines of code are executed?
    5·2 answers
  • How do media and networks interact
    11·1 answer
  • How would you define media literacy?
    12·1 answer
  • The tremendous diversity ofthe source system is the primary reason for their complexity. Doyou agree/ If so, explain briefly why
    11·1 answer
  • Python
    7·1 answer
  • Consider a router that interconnects four subnets: S1, S2, S3, and S4. Suppose all of the interfaces in each of these four subne
    9·1 answer
  • For what reasons do readers use text-to-speech tools? Check all that apply.
    8·2 answers
  • Denelle, an accountant, needs to present her client Stephen with a page showing how his yearly retirement savings will be affect
    11·1 answer
  • state how to transfee information from website to el processing document in computers and technology.​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!