aspose file tools*
The moose likes Beginning Java and the fly likes A rather long post of me talking gibberish and asking lots of questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A rather long post of me talking gibberish and asking lots of questions" Watch "A rather long post of me talking gibberish and asking lots of questions" New topic
Author

A rather long post of me talking gibberish and asking lots of questions

Hayden Perry
Greenhorn

Joined: Jan 21, 2013
Posts: 6
================================================== ================================================== ===
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. ;-)
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3950
    
  17

Wow, that is a wall of text. I am going to start picking off some of the questions, and ignoring others. I also am not about to read all that text so just know that I am taking the questions out of context...
Hayden Perry wrote:THE QUESTIONS!!!

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

SUPER isn't a thing in Java. The keyword super, but SUPER isn't. Java is case sensitive. The keyword super is used in a number of places for slightly different purposes. It can be used as a reference to the parent class (the class from which the current class extends) in order to call its methods or access its variables directly (possibly bypassing any overriden methods in this class). It can also be used on the first line of a constructor to invoke a particular constructor of the parent class.

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?

I will ignore the capitalization mistake because I already commented on it. The rest of the question makes no sense. Are you asking why you have to provide a name for the class that is the same as the name for the class? Because that is what you just did ask.

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

You don't need to. It is often very useful to do so since it helps encapsulate data and separate concerns from the outer class.

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]();?

This is a bit confusing, I think you are throwing JFrame into the question for no purpose, and it just confuses. I think what you are asking is what the new operator is for. The new operator is used to make a new instance of a class. Why do we need it? Because that is the semantics of the language. Just like you need the + operator to add two numbers and can't just do int sum = 1 2; instead of int sum = 1 + 2;

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

The actionPerformed method is a method defined in the ActionListener interface. You register an ActionListener with something which generates actions (like, for example, a JButton), and when the action happens (like someone pushes the button) the actionPerformed method gets called. It is called an event callback. Event callbacks in general are a key concept in Java's GUI mechanism.

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?

The type of an enum is a sub-type of Enum. Like String is a type, there is a special parent class for all enums (the Enum class). Then, when you define your own enum you are creating a new type which extends from enum. What would happen with your B = 5 situation? You should try it to see.

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

http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html

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

You are taking something out of context. That is not a thing in Java. Look at the context where you see it and perhaps it will become more clear.

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?

Assuming object is an Object, then you can't do ++object or object++. You need to look closely about what is actually being done in the code so you can ask questions appropriately.

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

Yeah, I would call that lazy. I feel like I should have read this first. It sounds like you don't want to put the effort into learning, in which case everything I posted was a waste of time. There is no silver bullet for learning, you have to work at it.

Steve
Hayden Perry
Greenhorn

Joined: Jan 21, 2013
Posts: 6
Hey thanks for the reply, I appreciate it and I do apologize for any confusions in questions or any pointless questions that were made. You have helped a bit, but to explain the questions you may not have understood:

4) I used the JFrame as an example because that's where I most commonly find it. The function JFrame() or whatever you have decided to call your window must be called in the main method using NEW [insert name of windows object]();. A good example would be this class I'm trying to code, it's all a bit test-y and it doesn't really work but my concept is there.



So basically what I'm asking is why must I make a new snake() object with NEW? Why can't I just call it with snake()?

9) I may not have described it very well, but here's an example I have taken from some random class, ignore the out of context code, it just explains the context of the question and what I am trying to ask as I have seen .ORDINAL in a few places.



For the laziness part I really do apologize if I have made you feel you have wasted your time on me, but I really appreciated the time you have given to help me because you have in some areas, so thank you. Although I do admit I am lazy, it's mainly because I always rely on others to guide me, but I suppose I need to work on that and hopefully programming will help me get past that and maybe I can learn new hobbies. ^^

Thanks for the help. Greatly appreciated.
Hayden Perry
Greenhorn

Joined: Jan 21, 2013
Posts: 6
Oh yeah and for the record, I purposefully typed the keywords and code-y stuff in caps, so it's obvious it's code and I'm not actually using it in a sentence. But thanks for the point out and the help. Might help someone else somewhere.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3950
    
  17

Hayden Perry wrote:Hey thanks for the reply, I appreciate it and I do apologize for any confusions in questions or any pointless questions that were made. You have helped a bit, but to explain the questions you may not have understood:

4) I used the JFrame as an example because that's where I most commonly find it. The function JFrame() or whatever you have decided to call

JFrame() or snake() is a Constructor, not a function. Constructors are important and different than functions or methods because they construct the class and have no return type.

...So basically what I'm asking is why must I make a new snake() object with NEW? Why can't I just call it with snake()?

And the answer stands - because that is the semantics of the language. It is the rules that the people who wrote Java came up with. Symbolically, it indicates that there is a lot more to making a new instance of a class than simply executing a constructor.

9) I may not have described it very well, but here's an example I have taken from some random class, ignore the out of context code, it just explains the context of the question and what I am trying to ask as I have seen .ORDINAL in a few places.



Still not enough context. Here we know that shape.ordinal() is a method called on the shape object. It must be defined in the shape's class (or one of its super classes). Beyond that is a guess (I have a good guess, but I won't share it until you do some more legwork). So what type is shape? Look up that type and see where the ordinal() method might come from.

For the laziness part I really do apologize if I have made you feel you have wasted your time on me, but I really appreciated the time you have given to help me because you have in some areas, so thank you. Although I do admit I am lazy, it's mainly because I always rely on others to guide me, but I suppose I need to work on that and hopefully programming will help me get past that and maybe I can learn new hobbies. ^^

Thanks for the help. Greatly appreciated.
Hayden Perry
Greenhorn

Joined: Jan 21, 2013
Posts: 6
Hey, for the shape.ORDINAL thing, some other guy answered it with this: "That's the "cheaty" Java way to retrieve the value of an enum key." a very nice chap who seemed to know what he was talking about. So you needn't worry about this question.

Thanks for your help, along side other people's contribution on other forums, lot's of my questions have been answered. I love the internet!

Thanks very much. :-)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Rather than using uppercase for code (which is confusing and flat-out wrong), use the "tt" button above the reply text area. it will put whatever is inside the "tt" tags in a "code font".

It will look like this: Jaba is case sensitive, so NEW is wrong, but new is correct.

Also, with regards to your "laziness": the only way to get any good at coding is to code, code, code, code, code, and then code some more. It's a lot of work and no one's going to hold your hand through it all. So if you feel that you're not going to be able to put a lot of effort into learning how to code, you may need to resign yourself to the fact that it's not for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Hayden Perry
Greenhorn

Joined: Jan 21, 2013
Posts: 6
Thanks for the tip, I didn't know at the time how to do that tt thing. Thanks very much I will consider that for the future.

I will take the advice dearly and code as much as I can! Thanks for your effort and contribution, it's a lot to ask.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

The "tt" tags are great for embedding code into sentences. For blocks of code, be sure to UseCodeTags (⇐ that's a link).
Hayden Perry
Greenhorn

Joined: Jan 21, 2013
Posts: 6
Oh ok, thanks. I will bear that in mind. :-)
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Hayden Perry, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/introductions/67928-rather-long-post-me-talking-gibberish-asking-lots-questions-please-read.html
http://www.javaprogrammingforums.com/java-theory-questions/22354-rather-long-post-me-talking-gibberish-asking-lots-questions-please-read.html


luck, db
There are no new questions, but there may be new answers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Steve Luke wrote: . . . 2) When making a new class and you type PUBLIC [insert class name here](){} . . .
The rest of the question makes no sense. . . .
I think he is trying to write a constructor.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Hayden Perry wrote: . . . ignore my age and understand my maturity . . .
If you are going to say you are 15, I shall call you an incurable optimist.

You will learn very little from a large wall of questions. You need to start small, and get simple things working first.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A rather long post of me talking gibberish and asking lots of questions
 
Similar Threads
SCJP motivational problems
Game making experience, looks bad or good for non-gameing companies?
Java vs C++
Y do u do this 2 ur posts
Books on internals of Java