Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- public class Point {
- protected int x;
- protected int y;
- public Point(int x, int y){
- this.x = x;
- this.y = y;
- }
- public String toString(){
- String text = "["+x+","+y+"]";
- return text;
- }
- public String toStringOther(){
- return Arrays.toString(new int[]{x, y});
- }
- public void setPoint(int x, int y){
- this.x = x;
- this.y = y;
- }
- public int getX(){
- return this.x;
- }
- public int getY(){
- return this.y;
- }
- public static void main(String args[]) {
- Point point = new Point(5, 10);
- System.out.println(point);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement