Results 1 to 3 of 3
  1. #1
    Nerijus is offline Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    22
    Rep Power
    0

    Default I need some help with composition, i think

    Hi I am new in this forum so sorry if it isn't proper place to ask this question. So the question:
    I have two classes:
    public class card {

    public void increase(Bankomatas b,int money){
    themoney=b.papildymas(100, this);
    System.out.println("It's OK");

    }
    }

    public class Bankomatas {

    public int money;
    private int diabetas=2000;

    public Bankomatas(int money){
    this.money=money;
    }

    public themoney papildymas(int sask, card kor){
    saskaita+=sask;

    return null;

    }
    }

    Error is in red. How I should it improve? :)

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,340
    Blog Entries
    7
    Rep Power
    20

    Default

    You are using 'themoney' as a variable at one place and as a return type at another place; that doesn't make sense.

    kind regards,

    Jos

  3. #3
    Nerijus is offline Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    22
    Rep Power
    0

    Default

    Em so how i could change it if i want that it would work in this way?

Similar Threads

  1. What is the Composition in Java
    By Santoshbk in forum Advanced Java
    Replies: 4
    Last Post: 04-10-2008, 11:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •