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: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    ================================================== ================================================== ===
    Before reading this MASSIVE post, please read the bottom at the stupid amount of P.P.S.'s as they probably have a lot of information that I forgot to put in the middle or something.
    ================================================== ================================================== ===

    Hi, I'm some guy on the internet and I am 15 years old. For the sake of this post and the answers I hope to have, please ignore my age and understand my maturity and I hope that you can understand why I would like to learn this language so much. I seem to have major issues with learning this language and online tutorials and stacks of books do not seem to do the trick. Please do not reply saying "this is not for you, try something else" because although I do not know much in Java in terms of making good applications, I have learned quite a few things and I am able to make simple things with the console such as making a calculator where the user has to type in what operator they want to use and then they are asked to enter two numbers in which they are timed/added/divided etc. together and it gives the answer. Considering this I really want to continue learning this language because I find it fun to learn and fun to program in, yet I am having serious stress issues because I can't understand simple things and I just forget some of them and I then find it difficult to make simple applications. For example, I am trying to make a simple snake game where you have to find all the apples and eat them and then your body grows larger etc. but I just can't think of how I would do it. I know a few simple application type things and maybe how to put them to use, but I just don't know how to use them in this situation and how to start off making games like these.

    Just to tell you a little bit about my background of programming, I have known about programming since I was about 11, I made a virus in Visual Basic believe it or not. It would disguise itself as Mozilla Firefox and would slowly delete random files that were opened or edited in the last month starting from the last used files in said month. It would delete a set amount of files every time you booted up and it was pretty nasty. It was obviously quite easy to get rid of it and it probably had many bugs, but it was a nasty virus nonetheless. Anyway, that lasted around 2 months and I never really picked up on programming until around 13 at which point I learned a bit of Java up until the System.out.println part, so not very far at all and I barely understood anything. Then I kinda picked it up at 14 last summer (2012) and learned almost as much I know now over the summer holidays and then kind of left it until after Christmas because I couldn't really get past a certain 'barrier' so I got bored and gave up. Until now. After Christmas I got back into it and starting learning a few more things, understood functions a little more and downloaded a bunch of source code from lots of different websites. I've now been extremely stressed out for the past 2 weeks going crazy because I can't fit anything else into my head because I just forget it or just don't understand it. So I am now in a complete frenzy not doing homework, being a douche to my friends and just not being very social or doing stupid things.

    Unfortunately this is going to be a rather long post as you can probably already tell and there will be a 20 Q's kind of 'game' below where I ask things that I desperately need to know and maybe things that I want to know but don't necessarily need to know.

    If you can, I would greatly appreciate it if you could answer all of the first 14 questions in one post instead of 1 or 2. Also, please do not post anything unnecessary or nasty as I am a new poster here and I just want to get started in Java and I have my own reasons for starting at such a young age and my intentions are rather personal. So please treat this matter with maturity and I hope someone can really help me.

    I am sorry for any misspellings or grammatical errors, I am fully English, I am just rubbish at spelling.

    THE QUESTIONS!!!

    1) What is SUPER used for, when should I use it and why should I use it?

    2) When making a new class and you type PUBLIC [insert class name here](){} what does this do and why does it need to be the same name as the class it is in?

    3) Why do you need to make new classes inside already made classes sometimes?

    4) What is the use of NEW and why do you need to use it when you are creating something like a JFrame, where for example you would use it in your main function and have NEW [insert name of function with JFrame inside]();, why can't you just do [insert name of function with JFrame inside]();?

    5) What is actionPerformed, where is it used and why should I use it?

    6) When using a function, what is achieved when you call another class and make another variable inside said function? Eg, public [insert class name here]([insert other class name here][insert new variable name here]){}

    7) What 'type' is an ENUM? Is it an int? String? Double? So if I were to make ENUM [insert name of enum here] {A, B, C, D, E, F, G}; So what would happen if I were to say PUBLIC [insert name of enum here] B = 5; what would that mean? Would that assign it as an integer?

    8) When should I use enums, what is the point in them?

    9) What does [inset object here].ORDINAL mean? What is it used for and when should I use it?

    10) Although I understand that the RETURN statement is used to end a function and return it with a value if there is one specified, but when it returns it with that value that you may have specified, what happens to that value, how do I retrieve it and how do I use it? When will I know when to use RETURN?

    11) Briefly explain how to use KeyEvent, getKeyCode and just anything else to do with accepting user input and how I would use it.

    12) When using the KeyAdapter, why do you need to make a new class inside an already made class? What does this achieve? Why can you not extend it on the current class you are using instead of making a new class? This links back to the 3rd question.

    13) What is the difference between ++object and object++? Does it really matter which way I use them? Why should I use them differently and how will it affect my code if I use them differently?

    14) What's the difference between an IF statement and a BOOLEAN statement? They are both booleans and if used correctly can be used to do the exact same thing with just one or two lines of codes difference. Which one should I pick over the other and why? Which one is better to use for what kind of things?

    ================================================== ================================================== ===
    POINTLESS QUESTIONS THAT I JUST FEEL LIKE ASKING THAT DON'T NEED TO BE ANSWERED AND DON'T HAVE MUCH TO DO WITH THE CODE ITSELF
    ================================================== ================================================== ===

    15) What is the best way to get into the mindset of 'a programmer'? What is the best way to understand the ways in which you would build an application and learning the step by step processes so you know what you have to do next and how to do it.

    16) I seem to always be worried that it takes programmers 5 minutes to program a very simple game, like Tetris because I've seen videos and just other places where it makes it look like it takes them a very small amount of time to make something that might take me months to learn. Is this how it works? Or can it take hours to program 5 classes for a very simple game? If so, why does it, if said programmer hypothetically understands the language well enough to make said program? Surely they would know what to do and how to make it so it would not take long at all?

    17) How often are IF and ELSE statements used in common programs? I feel when I am making a program I am always using them too much and I just stop programming from there because I feel that I am using too much of something so maybe it isn't the right way to do it or maybe there is a better way to do it.

    18) What would be the best way to learn programming for someone who finds it difficult to teach himself said topic yet has no efficient way to have someone teach him? I feel I am somewhat intelligent enough to learn a programming language, I have gotten this far, so I feel I should just keep going. Besides, despite the difficulties I have and the ridiculous amount of stress I get from not being able to learn on my own, I find it very entertaining to program things, read over other peoples code and slowly learn the world of programming. I feel that I see myself as a programmer in the future and I just really hope that I can learn this language quickly before I am too old to have time to learn this as a hobbie as I do now.

    19) I am someone who hopes to become a games developer as I thoroughly enjoy playing games as much as I do finding out how they work. What would be the right way about learning how to make games? Should I stick with Java or should I go to C++? I've only stuck with Java because I have more experience with it and I feel that I should learn an easy language and get used to OOP and other things before I go off making complex programs with a difficult language. I know how to print something to the console in C++ and that's about it.

    20) I have no way of having an education on programming in my school at the moment and all courses that have programming in them aren't very good - you make a simple application for coursework and you do a computer physics exam at the end of the year, not too helpful for me. Also, I don't have many friends that are diversed in any language of programming and the ones I do have, coincidentally, absolutely none of them are any good at making games or painting anything in graphics or anything to do with frames and windows. They're all about the console and making mods for games instead of making full on programs with a window and what not so it's difficult to get any of them to teach me anything. I've looked at college courses and none of them are for my age and what I am wanting, or they are just too damn expensive. I have also looked at online courses, one-to-one tutoring etc. but they are either way too expensive or they aren't very good in terms of being in a country half way across the world or maybe they have bad ratings. Anyway, what I'm trying to ask, despite all the negative put backs and all the issues that seem to follow me whenever I try to learn this damn language, what would be the best way to teach myself this language or any other language, or where are the best places to have someone teach me for free/cheap prices? I just essentially want to make something basic like a video game like Tetris or something so I at least have some knowledge of making a video game so I can maybe learn other things much easier.

    P.S. I am in top sets for all my classes at school, so any intelligence issues aren't a part of this. I guess you could maybe call it laziness, but I just prefer to say that I am too used to people teaching me things and doing things for me rather than teaching and doing things myself. So if I were stuck on an island alone I really would not know what to do at all because I would mainly rely on other people.

    P.P.S. Just for anyone's curiosity, I use Eclipse as my IDE on a Windows 7 Ultimate OS.

    P.P.P.S. I am British.

    P.P.P.P.S. I have read through about 4 books about Java, but on most of them I just get really bored and stop reading them half way through because they either don't explain what I want to know or they really suck at explaining what I want to know.

    P.P.P.P.S If you are going to post a good tutorial, please post one that I have most likely NOT been on. PLEASE. I have gone through MANY tutorials which all of them don't do me any favours. Please post one that you think that I might not have seen and actually tells me what EACH line of code does and WHY it does it and WHY I might use it and WHERE I might use it. Etc.

    P.P.P.P.P.S If this is a TL;DR kind of post, then I am awfully sorry to have bored you, please go onto another post, but thank you very much for taking the time to actually LOOK and CLICK on my post. However if you do not have any intention of helping my dilemma, please leave as although I am asking for A LOT for FREE, I really don't need pointless posts that really do not solve my problem. Thanks.

    P.P.P.P.P.P.S (Last P.P.S I swear! I just keep forgetting things.) If you have any questions to ask or I might not have asked something properly, feel free to ask as I will probably be refreshing this page non-stop for the next 2 weeks. Thanks ^^

    For all the people out there who are THAT awesome to post here answers to these questions, I really salute to you and I would VERY gladly give you money for your time and effort, if I had the funds to give you what it's worth. ;-)


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    Also at Java-Forums.org

    Please if you are going to start a discussion at multiple places, post a link at each to the others. That way everybody taking part in the discussion knows what else is being said. Be aware that many people will not spend time addressing matters that may well have been settled elsewhere.

    You might find it useful to organise your thoughts, and apply some care in the expression of them. People who post here generally expect and assume a seriousness of purpose on the part of those they are engaging with, and your post, possibly unfairly, doesn't give the impression that you care that much.

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    I do apologize, I do admit I did just post them on multiple forums hoping that I would essentially get the same answer from people but described in different ways so I can compare and understand a little better. I will make sure for next time I post on multiple forms that I provide links to where I have posted, so I do apologize once again.

    As for attitude to the matter, just to clear any doubts on me, I really have serious and although I do mention that I feel I might just be lazy, I do honestly want to learn this with full intention. I just find it rather difficult considering everything I have already stated in this post. Please ignore any negative attitude or anything that might impose myself as not caring as I am rather anti-social (cliché for a programmer that I hope to be I know) so finding the right words is difficult. I just hope that people can ignore what I say and just help me by answering the questions. It's a lot to ask from people especially considering the amount I have asked and the amount of nonsense I have made but I really do hope that despite that, people somehow see potential or at least something in me.

    Thanks for your time and I hope others see this rather than reading the first paragraph and leaving because they don't like what I am saying.

  4. #4
    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: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    FYI, quite a few of these questions could be answered by Google (or whatever search engine you prefer).

    1. Using the Keyword super

    2. Controlling Access to Members of a Class (I believe the rules are more or less the same concerning classes, maybe even exactly the same)

    3. There are a few reasons, usually because you want a particular class to exist in the context of another class. For example, you may want to create a Node class inside of a LinkedList class. The Node class would then have access to the fields of LinkedList it otherwise wouldn't as its own class (for example, private fields). Same goes for anonymous classes.

    4. The use of new is kind of a carry-over from C++. In C++ you had control of where objects would be allocated (either on the stack or on the heap). Objects allocated on the heap had to be instantiated using the new keyword. However, in Java all objects are allocated on the heap while primitives are allocated on the stack (there are wrappers objects for each primitive which can be instantiated on the heap, though this generally isn't a good idea).

    Java takes the approach of striving to be object-oriented. You operate on the level of objects. The syntax again comes more or less from C++ where you predicate a function call by the object you want to operate on.

    JFrame f = new JFrame(); // I now have a JFrame object which f refers to that I can work with
    // let's do a few different actions on that JFrame.
    f.setSize(400, 300);
    f.setVisible(true);

    There's nothing intrinsic to why you can't have another syntax convention where the object you're working on is the first parameter, it's just not how Java does it.

    5. Intrinsically there's nothing special about actionPerformed, though I'm assuming you're talking about the ActionListener interface. This interface is used by the Swing GUI toolkit for handling action events (the "default" Java GUI toolkit), for example when a user clicks a button.

    6. The declaration of a function defines it's name, what it returns, and what parameters it takes. The parameter values you call the function with are passed to the function. Well, sort of. The actual details are that primitive values are directly copied by value, i.e. manipulating one variable has no effect on the other variable. Objects have their reference/address copied by value so you can manipulate the same object from within a method, but you can't can't manipulate what object the other variable refers to.

    7. Enum is a class which extends Object. You can't assign values to Enum "keys", they are to be considered a constant identifier. The actual truth is that they are implemented using an integer which increments with each key declaration, but for the most part if you're using an Enum you shouldn't consider this implementation detail in your design (in general it's bad practice to try and take advantage of this fact).

    8. Use enums if you have a small set list of related constants, for example the days of a week.

    9. That's the "cheaty" Java way to retrieve the value of an enum key.

    10. Basically think of that value being a "drop in replacement" for the function call. Ex.:

    result = someCalculation(params);
    result2 = someCalculation(other_params) + func2(vals);

    11. Again these are Swing-specific API's. I would recommend reading How to Write a Key Listener

    12. It doesn't have to be inside another class, though it is perfectly valid if it is. See answer to #3 for why you may want to declare a nested class or an anonymous class instead of a separate class.

    13. object++ resolves to the original value of object. ++object resolves to the new value of object. In general when using the increment/decrement operators I only use them by themselves so there is no difference (since the resolved value never gets used). In Java these should perform equally as well, though if personally I prefer using ++object.

    14. An if statement is not a boolean. A boolean is a value type. It can be true, or it can be false. An if statement is a control statement. It dictates what code will run given the result of a boolean condition (true or false).

    boolean isJavaCool = true;
    if(isJavaCool)
    {
        System.out.println("you think Java is cool");
    }
    else
    {
        System.out.println("you don't think Java is cool");
    }

    15. Practice. There is quite a large learning curve with programming in any language. Don't let that discourage you as once you understand the fundamentals for it becomes much easier to apply that knowledge to learning multiple languages. Also understanding math really helps.

    16. The most time consuming part isn't in actually typing out the code. It's in the design and debugging of the program. Right now I've been working on a single class for the last few weeks in a row and I'm kind of getting close to a working version. Text-wise the code is not that long, maybe a few hundred lines (not that much, I've seen classes into the thousands of lines of code). Granted, I am very meticulously scrutinizing every line of code in a manner that your average programmer wouldn't, but even so the time I've spent debugging the code is enormous compared to actual typing coding. As you get more and more experience with different techniques it'll become easier to visualize how you would implement something, but I wouldn't expect someone to design, code, and debug a good Tetris game in 5 minutes.

    17. Quite often, but it is common for may programmers (new and old) to write program logic in a poor manner, resulting in unnecessary code. This is where math really helps as it helps you figure out how to reduce your code while still maintaining the intended flow. Often times it gets ignored because it doesn't matter if your program has the "best" performance, or even anywhere near the "best" performance.

    18. I wouldn't stress over it that much. I started out programming maybe a bit older than you did (~13-15) and I really didn't grasp it that well for several years. Granted, I was starting out with assembly (a poor choice in retrospect since other languages were available). It wasn't until I got to college that I really started getting the hang of programming. Just stick with it and try to have fun. If it's enjoyable to you you'll be more motivated to continue programming. If you've been stuck on a problem for a long time, take a break and come back to it later.

    19. I usually recommend people to learn as many languages as they can. Once you pick up the basic concepts learning another language isn't too difficult (usually). Java and C++ are quite similar syntax wise and I didn't have too hard of a time transitioning between the two. However, I can say that I have fallen for a lot more pitfalls in C++ than I have in Java because of the flexibility C++ offers.

    20. I've had pretty good experiences in the classes I've taken. In general I would recommend "generic" programming classes over "game" programming classes. They may not seem as exciting since you'll most likely be doing mundane things like implementing different sorting algorithms or tree data structures, but in the long run I would say these are more useful as the graphics portion is just an extension of the basic concepts (that's just me, though).

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    I could kiss you right now. I'll be honest I have posted the same question on multiple forums and you are the only one to answer ALL the questions. I thank you very dearly because not only will I memorise your username in my head forever, but also because you have just simply answered everything with perfection. If I could pay you, I would.

    I will read this over multiple times because I didn't quite understand a few things, but thank you very much. I hope you go somewhere good with your project.

  6. #6
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    I do apologize
    No need to worry. Attitudes to cross posting vary from site to site, and there do exist a layer of people who just won't respond to cross posts. So I think it's best to be upfront about that.

    HW922 has made a valuable contribution. I guess the second part of *my* post was motivated by a general point about programming: while completed programs of any quality are cool and "just work", the code that makes them up is always a study in expressiveness and attention to detail. The compiler insists that spelling and grammar is perfect, and the runtime punishes any fuzziness of thought mercilessly. (I'm talking about good programs. Then there's the cr@p...) These aren't skills anyone is born with. They have to be developed and are only developed if there is recognition that they are necessary.

  7. #7
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    Ha ha, thanks. You're the nicest moderator I've come across, despite the errors and wrongs I have made. I would love to talk to you more, but you're obviously rather busy.

    It's great to have someone so willing to help someone who essentially doesn't have a clue what he is doing compared to large corporate professional programmers.

    Just for the sake of not being selfish, I will go through some threads and help out anyone I can. Thanks for inspiration and help you've given me, greatly appreciate it. :-)

Similar Threads

  1. Comparing two coinflips, in JFrame, lots of problems need advice!!!
    By mindfcked in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 20th, 2012, 07:43 PM
  2. Created a Random Access File that saves gibberish to a text file
    By Deprogrammer in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 21st, 2012, 11:45 AM
  3. Question. Lots of Maths!
    By djl1990 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: October 28th, 2011, 10:57 AM
  4. Replies: 1
    Last Post: October 20th, 2011, 09:56 AM