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
Elena L [17]
3 years ago
14

Import java.util.ArrayList;

Computers and Technology
1 answer:
Nonamiya [84]3 years ago
3 0

Answer:

Explanation:

The following code was fixed but it is impossible to fix the entirety of the code without adjusting the Main method as well. This is because the information is being saved in an ArrayList that is saved within the main method. This means that either we need to move the Arraylist outside of the main method or adjust something inside the main method as well to make the code run. In this iteration, I have added an IF statement to the Point method so that it deletes a point if it is being added for a second time. In order to accomplish this, I had to add an extra argument when calling the Point Method in the Main method which would be the ArrayList in which the information is saved.

import java.util.ArrayList;

import java.util.List;

class PointTest {

   static final class Point {

       private double x, y;

       Point(double x, double y, List<Point> points) {

           this.x = x;

           this.y = y;

           for (int i = 0; i < points.size(); i = i+1) {

               if ((points.get(i).x == x) && (points.get(i).y == y)) {

                   points.remove(i);

               }

           }

       }

   }

   public static void main(final String[] args) {

       List<Point> pointList = new ArrayList<>();

       pointList.add(new Point(1, 2, pointList));

       pointList.add(new Point(3, 4, pointList));

       System.out.println(pointList.size());

// remove the second Point

       pointList.remove(new Point(3, 4, pointList));

       System.out.println(pointList.size());

// REMOVED!!!!!

   }

}

You might be interested in
What nondestructive testing method requires little or no part preparation, is used to detect surface or near-surface defects in
drek231 [11]

Answer:

Eddy current inspection

Explanation:

According to my research on nondestructive testing methods, I can say that based on the information provided within the question the method being described is called Eddy current inspection. This is a method that uses electromagnetic induction to detect and characterize surface and sub-surface flaws in conductive materials

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
3 years ago
Identify the correct XHTML syntax for inserting an image as a hyperlink from the options provided. A. book.gif B. C. D.
mariarad [96]

Answer:

The Correct syntax for inserting an image as hyperlink is given in explanation section

Explanation:

To make an image act as a hyperlink, place the image element within the HTML anchor "<a></a>"  element.

The syntax of inserting image hyperlink in XHTML is given below.

<a href = "link_that_can_be_accessible"><img src="source of image" alt="display name if image not shown in the browser" border="0"/></a>

for example lets insert image as hyperlink

<a href="ajax.html"><img src="logo.gif" alt="AJAX" border="0" /></a>

The default appearance is a blue border around the image. Specifying border="0" removes the border around the image.

if you want to insert image from another folder then the image hyperlink looks like this:

<a href="ajax.html"><img src="/images/html5/logo.gif" alt="AJAX" border="0" /></a>

If you want to insert image from another server then image hyper link looks like this:

<a href="ajax.html"><img src="https://www.myExample.com/images/html5/logo.gif" alt="AJAX" border="0" /></a>

4 0
3 years ago
Use of the internet to access programs and data on computers that’s are owned and managed by the other using large data centers.
Nimfa-mama [501]

Answer:

I just wanna learn how to code

Explanation:

6 0
3 years ago
Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Taya2010 [7]

Answer:

Attached is a screenshot of my code for 'PasswordGenerator' and the tests necessary.

Explanation:

If you need any explanation, please ask!

3 0
3 years ago
Read 2 more answers
When replacing a system board in a laptop, which feature is a must?
Sphinxa [80]
I would use a dual core Becuase a quad can be too space consuming and it can overheat the computers software
6 0
3 years ago
Other questions:
  • When a server crashes and goes offline on a network, which of the following helps to determine that the server is unavailable?
    9·1 answer
  • _____ are likely to support bigger government, social welfare programs, and legalized abortion.
    8·2 answers
  • The ____ command displays the last 10 lines of a text file.
    5·1 answer
  • How does technology make America great?​
    10·1 answer
  • There are two main advantages to using multiple threads in a process: 1) Less work involved in creating a new thread rather than
    7·1 answer
  • Write an algorithm that accepts two numbers,
    7·1 answer
  • I’ll mark brainliest, thanks
    10·2 answers
  • Write a method that takes a RegularPolygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclus
    10·1 answer
  • Why do we need operating systems?
    7·1 answer
  • How to create drop down list in excel with multiple selections.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!