int m_x;
int m_y;
// Constructor sin argumentos
this(0, 0); // Llama al constructor con dos argumentos
}
// Constructor con argumentos
public Point(int x,
int y
) { m_x = x;
m_y = y;
}
}
class MyProgram {
public static void main
(String[] args
) { Point origin
= new Point(); // Crea un objeto Point con (0, 0) Point p
= new Point(5,
5); // Crea un objeto Point con (5, 5)
// Imprimir los valores para verificar
System.
out.
println("Origin: (" + origin.
m_x + ", " + origin.
m_y + ")"); System.
out.
println("Point p: (" + p.
m_x + ", " + p.
m_y + ")"); }
}
Y2xhc3MgUG9pbnQgewogICAgaW50IG1feDsKICAgIGludCBtX3k7CgogICAgLy8gQ29uc3RydWN0b3Igc2luIGFyZ3VtZW50b3MKICAgIHB1YmxpYyBQb2ludCgpIHsKICAgICAgICB0aGlzKDAsIDApOyAvLyBMbGFtYSBhbCBjb25zdHJ1Y3RvciBjb24gZG9zIGFyZ3VtZW50b3MKICAgIH0KCiAgICAvLyBDb25zdHJ1Y3RvciBjb24gYXJndW1lbnRvcwogICAgcHVibGljIFBvaW50KGludCB4LCBpbnQgeSkgewogICAgICAgIG1feCA9IHg7CiAgICAgICAgbV95ID0geTsKICAgIH0KfQoKY2xhc3MgTXlQcm9ncmFtIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBQb2ludCBvcmlnaW4gPSBuZXcgUG9pbnQoKTsgLy8gQ3JlYSB1biBvYmpldG8gUG9pbnQgY29uICgwLCAwKQogICAgICAgIFBvaW50IHAgPSBuZXcgUG9pbnQoNSwgNSk7ICAvLyBDcmVhIHVuIG9iamV0byBQb2ludCBjb24gKDUsIDUpCgogICAgICAgIC8vIEltcHJpbWlyIGxvcyB2YWxvcmVzIHBhcmEgdmVyaWZpY2FyCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJPcmlnaW46ICgiICsgb3JpZ2luLm1feCArICIsICIgKyBvcmlnaW4ubV95ICsgIikiKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIlBvaW50IHA6ICgiICsgcC5tX3ggKyAiLCAiICsgcC5tX3kgKyAiKSIpOwogICAgfQp9Cgo=