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

Thread: Need a little guidance on overall Java

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    18
    My Mood
    Sleepy
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Need a little guidance on overall Java

    Hi guys!

    So I've been thinking about creating a Hi-Lo game for the past few days as I am still really new to programming and I think it would be a small project for me. I have a few issues though that I am worried about.

    My first issue is that I still find myself getting confused sometimes with method parameters.. I have no idea why but I seem to forget about them all the time when writing my code, even though I know how they work. Any ideas on how I can improve this? I also sometimes feel that even though I know what certain things in the Java language do, I don't know how to use them to the full potential. I practice a lot and read/watch about different topics but the examples are often very basic and not related to real world code.

    Finally, when writing code I sometimes find myself jumping from class to class and I think is bad practice if I am correct? I've been working on my class structures to try and resolve this issue. Any tips for this?

    Thanks in advance and sorry for the long post
    Last edited by SauronWatchesYou; April 9th, 2014 at 06:12 AM.


  2. #2
    Junior Member
    Join Date
    Apr 2014
    Posts
    22
    My Mood
    Lonely
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    Well what is the main problem with your question? I dont really understand. If you tell me what subjects you need help with I will help you.

    System.out.println("need more info....)


    Bye

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need a little guidance on overall Java

    Here's a tutorial that shows you how to write a higher/lower game in Java: Higher/Lower - Tutorials - Static Void Games

    But the best advice I can give you is to START SMALL and TEST OFTEN. Instead of trying to write your whole program and jump from class to class, test a single line at a time. Test a single method at a time. Make sure that the small piece you're working on works before moving on to the next step. Trying to combine a bunch of half-working pieces is just going to give you a headache.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Need a little guidance on overall Java

    What do you mean by forgetting method parameters? Are you using an IDE like Eclipse? If so, attach javadocs to your methods. When you are using Eclipse (or other IDEs like it), you are given "suggestions" when typing (such as a list of methods you can use and such). If a method had a javadoc attached, it will show up alongside the suggestion.
    In the javadoc, you would explain the purpose of each parameter.

    Like all things, start from the foundation. When coding an OO language (like Java), your foundation is usually your model classes. Model classes are concrete things. Like if you have a Tree class, or a Person class, or whatever. These are part of the model, and they should be set up to some extent in the beginning.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  5. #5
    Junior Member
    Join Date
    Apr 2014
    Posts
    18
    My Mood
    Sleepy
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: Need a little guidance on overall Java

    Thank you all for your replies, sorry that I am replying late myself, I've been busy with studying.

    The thing about forgetting about method parameters, was more of an issue of not understanding them correctly.
    This example would confuse me.

    "public void getButton(Jbutton button){"

    I understand what this means now and how to make it work which is great !

    I have one final question however. I always found polymorphism.. useless for what I wanted? I was looking at some code that had the following:

    "ActionListener listener = new RockPaperListener(buttons go here etc);"

    Is is correct that this is indeed polymorphism, as you are saying that the reference for ActionListener is equal to the class instance of RockPaperListener? I understand about method overring etc but this always threw me a little.

  6. #6
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Need a little guidance on overall Java

    Think "type". The listener variable is of type: ActionListener. This means that regardless of what is assigned to the listener variable, only methods from the ActionListener class can be used.
    RockPaperListener is a subclass (or: subtype) of ActionListener. An instance of RockPaperListener can be assigned to a variable of RockPaperListener type, or a variable of any supertypes (such as ActionListener). The cavet here is that despite the listener variable being assigned to an instance of RockPaperListener, the variable STILL can only access methods in the ActionListener class. Method overriding is realized at runtime. So at runtime, if the VM knows that listener is "really" an instance of RockPaperListener (instead of just an ActionListener), any overridden methods are used.
    Tell me what you do and don't understand.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  7. #7
    Junior Member
    Join Date
    Apr 2014
    Posts
    18
    My Mood
    Sleepy
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: Need a little guidance on overall Java

    Thanks for clearing that up aussie! I understand that, I believe. I have been working on a project for a while was wondering where I can upload some screenshots/code?

    Thanks again

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need a little guidance on overall Java

    Quote Originally Posted by SauronWatchesYou View Post
    Thanks for clearing that up aussie! I understand that, I believe. I have been working on a project for a while was wondering where I can upload some screenshots/code?

    Thanks again
    Are you asking how to show off what you've done so far?

    If so, the cafe section of this forum is for that type of thing: The Cafe

    But honestly, you probably won't get a lot of hits from that, since this is primarily a technical forum. You might also try the Work-In-Progress board at JGO: WIP games, tools & toy projects - Java-Gaming.org

    Other than that, putting together a little website for people to visit is probably your best bet. The link in my signature to Static Void Games is my attempt at making that process easier for people.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  9. #9
    Junior Member
    Join Date
    Apr 2014
    Posts
    18
    My Mood
    Sleepy
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: Need a little guidance on overall Java

    Quote Originally Posted by KevinWorkman View Post
    Are you asking how to show off what you've done so far?

    If so, the cafe section of this forum is for that type of thing: The Cafe

    But honestly, you probably won't get a lot of hits from that, since this is primarily a technical forum. You might also try the Work-In-Progress board at JGO: WIP games, tools & toy projects - Java-Gaming.org

    Other than that, putting together a little website for people to visit is probably your best bet. The link in my signature to Static Void Games is my attempt at making that process easier for people.
    Thanks for letting me know Kevin btw I love your site, I've been taking a look through it to get a more in depth look at certain aspects of the Java language and I find myself visiting it every now and then.

  10. #10
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need a little guidance on overall Java

    Thanks, that's awesome to hear! I've got some big plans for this summer that I'm really looking forward to, so stay tuned!
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. I Require some guidance :)
    By Vryizen in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 12th, 2013, 03:13 PM
  2. Recursion Guidance
    By Mission_Control in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 2nd, 2011, 09:35 PM
  3. Some guidance with a program please
    By derekxec in forum Java Theory & Questions
    Replies: 3
    Last Post: June 11th, 2011, 05:52 AM
  4. Looking for guidance and instructions
    By coyboss in forum Java Theory & Questions
    Replies: 4
    Last Post: February 12th, 2011, 10:57 AM
  5. [SOLVED] Medication of ArrayDemo.java to include iterative menu
    By xyldon27 in forum Loops & Control Statements
    Replies: 8
    Last Post: June 30th, 2009, 02:10 AM