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 7 of 7

Thread: multiple methods in one class

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default multiple methods in one class

    Is it possible to have multiple methods in one class?
    And can I use the Scanner in methods other than the main method?

    Many thanks


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: multiple methods in one class

    Odd question. It's unusual to NOT have multiple methods in one class. Yes, a Scanner object may be used in methods other than the main() method. These are both odd questions and could be easily answered by writing a few lines of code.

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: multiple methods in one class

    thank you Greg. I'm just trying to figure out why one of my methods don't work when I run the programme.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: multiple methods in one class

    Post the code you're having problems with and we can be more help.

  5. #5
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: multiple methods in one class

    Copy and paste the exact error messages as well.
    Improving the world one idiot at a time!

  6. #6
    Junior Member
    Join Date
    Sep 2014
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: multiple methods in one class

    I don't know what happened to it >.> The file just won't open. Oh well, if I come across the same problem I will come back to this thread. Thank you anyways guys.

  7. #7
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: multiple methods in one class

    The file just won't open.
    My dog ate it.

Similar Threads

  1. Multiple Static Methods and printing to different .txt file?
    By Clockwork in forum What's Wrong With My Code?
    Replies: 0
    Last Post: July 17th, 2013, 09:11 PM
  2. Forming Multiple Methods - please help explain this for a newbie?
    By RedCloudTsunami in forum Java Theory & Questions
    Replies: 1
    Last Post: July 5th, 2012, 04:56 PM
  3. JOptionPane menu and multiple methods
    By kubera in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 3rd, 2012, 07:03 PM
  4. Multiple methods in the same inner class?
    By tommyf in forum What's Wrong With My Code?
    Replies: 12
    Last Post: January 24th, 2012, 01:10 PM
  5. Completely Lost in this problem(multiple methods)
    By wacarter in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 31st, 2010, 04:44 PM