fork download
  1. class Point {
  2. int x;
  3. int y;
  4. // コンストラクタを設定する
  5. Point(int x, int y) {
  6. this.x = x;
  7. this.y = y;
  8. }
  9. // 自身を返すようにする
  10. Point multiply(int n) {
  11. this.x *= n;
  12. this.y *= n;
  13. return this;
  14. }
  15. boolean isSamePosition(Point p) {
  16. // そもそも条件節に入るものはtrueかfalseを返すのは自明なんで、改めて条件で分岐してtrueやfalseを返さない
  17. // 直接真偽値を演算する「論理演算」自体をを返してしまえ
  18. return this.x == p.x && this.y == p.y;
  19. }
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
spoj: The program compiled successfully, but main class was not found.
      Main class should contain method: public static void main (String[] args).
stdout
Standard output is empty