Computers and Technology

If the point class doesn’t override the equals() method in the object class, what will the following code do? point pointone = new point(3, 4); point pointtwo = new point(3, 4); system. out. println(pointone. equals(pointtwo)); a. print “true” to the console b. cause a compile-time error since the equals() method doesn’t exist in the point class c. print “false” to the console d. cause a compile-time error since the equals() method can’t accept a point object 2 points

answer
Answers: 2

Similar questions

Предмет
Computers and Technology, 23.10.2019 19:00, dakotacsey03
Add the following method to the point class: public double distance(point other) returns the distance between the current point object and the given other point object. the distance between two points is equal to the square root of the sum of the squares of the differences of their x- and y-coordinates. in other words, the distance between two points (x1, y1) and (x2, y2) can be expressed as the square root of (x2 - x1)2 + (y2 - y1)2. two points with the same (x, y) coordinates should return a distance of 0.0. public class point { int x; int y; // your code goes here } 2. create a class called name that represents a person's name. the class should have fields named firstname representing the person's first name, lastname representing their last name, and middleinitial representing their middle initial (a single character). your class should contain only fields for now. 3. add two new methods to the name class: public string getnormalorder() returns the person's name in normal order, with the first name followed by the middle initial and last name. for example, if the first name is "john", the middle initial is 'q', and the last name is "public", this method returns "john q. public". public string getreverseorder() returns the person's name in reverse order, with the last name preceding the first name and middle initial. for example, if the first name is "john", the middle initial is 'q', and the last name is "public", this method returns "public, john q.". 4. add the following method to the point class: public int quadrant() returns which quadrant of the x/y plane this point object falls in. quadrant 1 contains all points whose x and y values are both positive. quadrant 2 contains all points with negative x but positive y. quadrant 3 contains all points with negative x and y values. quadrant 4 contains all points with positive x but negative y. if the point lies directly on the x and/or y axis, return 0. public class point { private int x; private int y; // your code goes here
Answers: 1
Do you know the correct answer?
If the point class doesn’t override the equals() method in the object class, what will the following...

Questions in other subjects:

Konu
Mathematics, 19.01.2020 15:31