# Help learning Java

#### Animekitty

##### baby marshmallow born today
I am having trouble learning it by myself.

could some one help with a few examples(specifically a GUI).

I learn better with human interactions.

#### Joz_helloworld

##### Member
How are you learning it? Stanfords Programming Methodology, another self-taught method, or at an actual class? I'm not suggesting that you can't find help here, but you may want to check out openstudy.com they have a very friendly forum that will help with specific com sci questions, takes some time to get answers however.

#### Animekitty

##### baby marshmallow born today
I would like to put a picture in a window but I don't think I am using the correct syntax.

Code:
import javax.swing.JFrame;
import javax.swing.ImageIcon;

class Fox{
public static void main(String[] args) {
ImageIcon image = new ImageIcon("fox.jpeg");

JFrame f = new JFrame("Fox");
f.setSize(image.getLength, image.getHiegth);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}

#### walfin

##### Democrazy
You must put the ImageIcon into a Label and add the label.

Not gonna write the thing for you so you can learn .

Also, why is your class not public?

Another suggestion - why don't you subclass JFrame, you will find that it makes things a lot more convenient when you write bigger apps.

Oh BTW, I suggest that you use Nimbus look & feel too. I find it looks better.

#### Valentas

##### Well-Known Member
"Thinking in Java" by Bruce Eckel. Read that monster, after each chapter apply new knowledge by building some project. Repeat. It will take tons of time to go through that book but it is one of the most complete Java books...

If you have troubles, google that stuff out in stack overflow. I found that it does not pay to keep being stuck when you can find the answer. You simply learn it and you're good to go faster.

#### Amagi82

##### Curse your sudden but inevitable betrayal!
I've been learning Java for Android since the beginning of the year, and I heartily recommend using Eclipse if you're not already. It's a big help and does a lot of the tedious shit for you, and highlights the majority of your mistakes. There's actually some pretty decent video tutorial series on Youtube- I'm 2/3 of the way through a 200 video Android series. I haven't tried their regular Java series, but I really like the Android series- it's been an enormous help.

Here's the Java tutorial series: http://www.youtube.com/watch?v=Hl-zzrqQoSE&list=PLAFF55E55870752DA

And here's the Android one: http://www.youtube.com/watch?v=SUOWNXGRc6g&list=EC2F07DBCDCC01493A

I've been setting two computers up side by side, with the video tutorial on one and doing all the programming on the other, which means not alt-tabbing every 3 seconds, which is nice. I definitely recommend that strategy.

#### Valentas

##### Well-Known Member
Both tutorial series sucks.

Java one just shows syntax but never construct programs and explain why.

Android tutorial series is hopelessly outdated.

I learn stuff from this guy: I talked with him on Skype and he's great person. A word of warning, he's fast.

You can find what you need in his playlist: http://www.youtube.com/channel/UCwRXb5dUK4cvsHbx-rGzSgw

#### Valentas

##### Well-Known Member
Also, here is a free book on data structures which I just found: http://opendatastructures.org/ods-java.pdf

And study this book, solve most of the problems and you're good to go. I wonder whether @Architect agree if this book would prepare for a job in your company? Cracking the Coding Interview: 150 Programming Questions and Solutions: Gayle Laakmann McDowell: 9780984782802: Amazon.com: Books@@AMEPARAM@@http://ecx.images-amazon.com/images/I/517bTx5Cp-L.@@AMEPARAM@@517bTx5Cp-L

I bought this book to study and ended up understanding how much stuff I don't know. I'm now in a deep study of data structures at the moment...

#### Architect

##### Professional INTP
Also, here is a free book on data structures which I just found: http://opendatastructures.org/ods-java.pdf

And study this book, solve most of the problems and you're good to go. I wonder whether @Architect agree if this book would prepare for a job in your company?
It seems good but I haven't read it. My particular company demands a particular set of skills (physicist programmers often get hired for example) so we're atypical.

In an interview you get bunted from a bunch of engineers, with a manager and HR person thrown in too. How it goes really depends on who is asking you the questions. xSxx are the worse, in my opinion, because they ask specific questions and want you to actually come up with a correct solution. I think this is entirely wrong. When does it happen in the real job that you have to work under such pressure? We're not engineers in Star Trek here. In the real world software engineers always have some schedule pressure, but they get plenty of quiet down time to figure out the answers. I think they do this just because they are such detail hounds.

What I do is to talk about their past and try to figure out what kind of person they are. Can I work with them? The most important question in my mind is are they doing this because it's a career, or because they love it? I almost always hire the latter. The former people will just barely perform their jobs.

This is why I hate interviewing and have done as little of it as I can.

#### Valentas

##### Well-Known Member
Haha, I agree. I'm terrible under pressure too. For instance, when I was doing my school exams, time constraints and other factors introduced some silly errors in my maths paper. I got 95% but I would have got maximum if it was not pressure and little time left to solve everything.

I talked with one guy who is a couple years older than me. He was interviewed as an intern in software company and was asked very simple question: create an object and call it's method.

He wrote the answer easily. Interviewer stared at him and said that it is not correct at all.
His writing was something like this: Node node = new Node; node.delete(); which is correct example of what he was asked.

After some silence, he asked for an answer. The dude interviewing him said that he forgot main method... Then my friend answered that the dude forgot another thing - JVM

Silly questions. And result is wasted time and an idiot who proved that my friend should not work for that company, especially under supervision of such dude...

#### Amagi82

##### Curse your sudden but inevitable betrayal!
I've found the S's that do a lot of the hiring tend to have a shit-ton of the terminology memorized, while failing to understand anything beyond that. For really strong N's like myself, it's really frustrating, because I understand the underlying concepts, but could not give a flying shit about what people call them. I had a guy the other day lecture me, lecture me, about not knowing what a model-view-controller was (I started learning from square one at the beginning of the year, and I've had zero formal training). I went home, looked it up, and discovered I was using the m-v-c model without even realizing there was a term for it. Later, I wondered why anyone would even bother making a term to describe it.

#### walfin

##### Democrazy
How it goes really depends on who is asking you the questions. xSxx are the worse, in my opinion, because they ask specific questions and want you to actually come up with a correct solution.
Haha I bet they memorise 10-years-series of correct answers.

His writing was something like this: Node node = new Node; node.delete(); which is correct example of what he was asked.
Lemme be an S... you forgot the BRACKETS!

Node node= new Node();

Your friend shoulda just said "I wrote it in pseudocode".

I've found the S's that do a lot of the hiring tend to have a shit-ton of the terminology memorized, while failing to understand anything beyond that. For really strong N's like myself, it's really frustrating, because I understand the underlying concepts, but could not give a flying shit about what people call them. I had a guy the other day lecture me, lecture me, about not knowing what a model-view-controller was (I started learning from square one at the beginning of the year, and I've had zero formal training). I went home, looked it up, and discovered I was using the m-v-c model without even realizing there was a term for it. Later, I wondered why anyone would even bother making a term to describe it.
Sorry, dude, but MVC is pretty basic terminology.

You don't want to be going "y'know, that structure where there's something that handles the data, and then there's something for the interface, and the logic is in-between?" every single time.

And industry standard terminology is needed. Can you imagine this - "What are arguments? Oh, those things in the brackets in function calls? I always called them bracket-packets!"

#### Valentas

##### Well-Known Member
Ah yes, I forgot brackets somehow but he did not. Anyway isn't it funny when you are asked to write every single detail? As if person who creates object does not know that main method is common sense lol.

If he had written stuff in pseudocode it would certainly be bad. He was asked code, not pseudocode :}

Yeah, terminology is important in programming. Do you know why it is important and helpful to know all terminology? Because one little title of some stuff will result in a huge chain of associated work you've done with in your brain to be remembered. As an example, you can say me 'derivative' and I then remember all the stuff I have done with it..

HEY OP, http://www.cs.berkeley.edu/~jrs/61b/

#### Amagi82

##### Curse your sudden but inevitable betrayal!
You don't want to be going "y'know, that structure where there's something that handles the data, and then there's something for the interface, and the logic is in-between?" every single time.

And industry standard terminology is needed. Can you imagine this - "What are arguments? Oh, those things in the brackets in function calls? I always called them bracket-packets!"
Besides sitting at a job interview, when am I ever going to need to describe that process to someone? Why would I discuss anything involving technical terms with another human being?

I'm perfectly capable of walking without knowing what every bone and muscle is called.

#### walfin

##### Democrazy
Besides sitting at a job interview, when am I ever going to need to describe that process to someone? Why would I discuss anything involving technical terms with another human being?

I'm perfectly capable of walking without knowing what every bone and muscle is called.
Because on big projects, there is more than one person on the team.

You need to explain to others what your code is doing because they are going to call it. You also need to discuss structure with others so that there is no duplicate work and there is no conflict between what the different components are doing.

If you believe that you can finish everything alone (by the deadline), you have simply not been on a sufficiently big project before.