Results 1 to 3 of 3
  1. #1
    snobbysteven is offline Member
    Join Date
    Oct 2012
    Posts
    17
    Rep Power
    0

    Default Java class method to another class

    public board()
    {
    initBoard();
    writeBoard();
    setSchedule();
    }

    my question is how can i pull this constructor into another class such as.

    board b = new board();

    now i want to do.

    b.board(); and pull those 3 methods so its a little cleaner in my demo class, but it keeps coming up wrong but im not sure the proper way to write it.
    Last edited by snobbysteven; 05-07-2013 at 06:09 AM.

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

    Default Re: Java class method to another class

    When you do "new Board()" the new Board already did "initBoard(); writeBoard(); setSchedule();" for you; there's (probably) no need to do it again.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: Java class method to another class

    it keeps coming up wrong
    When you get a compiler message you don't understand it helps a lot to copy and post that message along with the code it refers to.

Similar Threads

  1. Replies: 8
    Last Post: 04-18-2012, 04:58 PM
  2. Replies: 0
    Last Post: 12-07-2011, 11:55 AM
  3. Replies: 5
    Last Post: 01-26-2011, 06:38 PM
  4. Replies: 2
    Last Post: 05-01-2010, 08:59 AM
  5. Child-Class Calling a Method in a Parent-Class
    By Blah_ in forum New To Java
    Replies: 5
    Last Post: 09-29-2009, 02:48 AM

Tags for this Thread

Posting Permissions

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