Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Beginner method call problem

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Beginner method call problem

    Hi,

    I need help to get the method below "createarticle" to call a a new method called "outprintarticlecreated()" in the same class. The new "outprintarticlecreated()" method should just print out with JOptionPane that a new article has been created. It should be easy, but I cant get it right and I tried with tutorials. Beginner problem.. Please help me someone!

    public void createarticle(String artId, String name, int instock,
    double price) {
    Register.artikelRegister.put(artId, new Artikel(artId, name,
    instock, price));
     
    } 
    outprintarticlecreated();
    JOptionPane.showMessageDialog(null, "Article created!")
    Last edited by helloworld922; May 10th, 2011 at 02:59 PM.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Beginner method call problem

    It looks like you're code is missing some syntax sugar:
    the method call to outprintarticlecreated() should be inside of the createarticle method (suggestion: use the camel case naming convention)
    You also need to define outprintarticlecreated (see the signature of createarticle for how to do this).

  3. #3
    Junior Member
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Beginner method call problem

    Solved...so easy. Thanks!

Similar Threads

  1. Need help implenting arrays and method call into existing code
    By hoven in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 31st, 2011, 01:36 AM
  2. call super method outside of 'this'
    By questionmark in forum Object Oriented Programming
    Replies: 1
    Last Post: January 29th, 2011, 11:29 AM
  3. Beginner Problem
    By nve5009 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 19th, 2010, 11:29 AM
  4. Can i call init() method in destroy method.?
    By muralidhar in forum Java Servlet
    Replies: 1
    Last Post: October 22nd, 2010, 11:18 AM
  5. [SOLVED] Java exception "result already defined"
    By rptech in forum Object Oriented Programming
    Replies: 3
    Last Post: May 20th, 2009, 05:48 AM