Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Punkt.java
- //! import javax.swing.*; // Zbędne.
- // Nie używamy polskich znaków w nazwach, gdyż mogą pojawić się
- // problemy z czymkolwiek.
- public class Punkt{
- //! protected double x; // Nie używamy protected, chyba że naprawdę jest
- //! protected double y; // potrzebne (przy dziedziczeniu klas).
- private double x;
- private double y;
- //! public Punkt(x,y){ // Brakuje typów parametrów
- public Punkt(double x, double y) {
- //! this.x = p.x; // Skąd to p?
- //! this.y = p.y;
- this.x = x;
- this.y = y;
- }
- public Punkt przesuniecie(double a, double b) {
- this.x += a;
- this.y += b;
- return this;
- }
- public String toString() {
- //! return "(" + x + ", " + ")";
- return "(" + x + ", " + y + ")";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment