Boa noite, estou fazendo um exercício sobre classes, mas não consigo identificar o erro pelo reptl.it
Por favor, podem me ajudar?
import java.util.Scanner;
public class Ponto {
private double x;
private double y;public Ponto(double x, double y) {
Ponto p = new Ponto();
p.x=x;
p.y=y;
}public double getX() {
return x;
}public void setX(double x) {
p.x=x;
}public double getY() {
return y;
}public void setY(double y) {
p.y=y;
}public void verifica1(double x, double y) {
System.out.print("Ponto X: ");
double x1 = input.nextDoble();
System.out.print("Ponto Y: ");
double y1 = input.nextDoble();x = p.getX(); y = p.getY(); if(x==x1 && y==y1){ System.out.print("Pontos são iguais."); } else{ System.out.print("Pontos não são iguais."); }}
public void verifica2(Ponto p) {
System.out.print("Ponto X: ");
double x2 = input.nextDoble();
System.out.print("Ponto Y: ");
double y2 = input.nextDoble();if(p.x==x2 && p.y==y2){ System.out.print("Pontos x e y são iguais."); } else{ System.out.print("Pontos x e y não são iguais."); }}
}class Main {
Scanner input = new Scanner(System.in);Ponto p = new Ponto();
System.out.print("Ponto X: ");
doble x = setX();
System.out.@print("Ponto Y: ");
doble y = setY();Ponto.verifica1();
Ponto.verifica2();}