Jump to content
NEurope
Ashley

Learning Java!

Recommended Posts

I decided I want to get into app development (one of those half cocked ideas you have while half soaked) so I'm looking into Java.

 

Going to borrow a few books from the library at work and was hoping to take a course there but the next one that starts is in September (and it would be easier to make them pay for one we do rather than making them pay for one someone else does...but not impossible so I'll see).

 

Anyone knows it? Got any tips, websites, tutorials etc?

Share this post


Link to post
Share on other sites

I thought Android and iOS apps were written in Java but it turns out iOS is written in C++. Damn it. Need to get my thinking hat on.

Share this post


Link to post
Share on other sites
I thought Android and iOS apps were written in Java but it turns out iOS is written in C++. Damn it. Need to get my thinking hat on.

 

Yeah, Android apps are written in JAVA (and XML). I was working on a Android app for work but I haven't finished it yet. I've been meaning to learn it properly though, I'm just guessing my way through mostly.

 

I'd recommend getting a book aimed at Android development though if that's what you want to do rather than a general one. Although I have the JAVA for Dummies 12 in 1 or something book which is pretty decent.

 

Also, you'll want to download Eclipse IDE. There's a plugin for the Android SDK which makes things easier.

Share this post


Link to post
Share on other sites

@Ashley:

 

The first place to start would be the Oracle website with Java tutorials. Under "Trails Covering the Basics" the "Getting Started" section and the "Learning the Java Language" sections should provide a good introduction.

 

I don't know a thing about Android development except that Java can be used. For that you'd have to look for specific tutorials/books etc..

 

Edit: In the "getting started" section they're showing the usual Hello-World using the NetBeans IDE. For lack of experience with it, I can't say if it's a good choice, but listen to @Ike and use Eclipse instead. ;)

Edited by Burny

Share this post


Link to post
Share on other sites

Alright, its great that you're wanting to learn how to program, but it sounds like you're not planning to go about it the best way. First of all, forget android apps for now. Its good to keep a goal in mind, but if you try and learn to program that way, you'll likely develop bad habits, and have trouble applying what you learn to other scenarios. Essentially, you'll end up learning only how to do the things that you needed to do to develop apps. You won't know how to do anything else, you won't know how anything actually works, and you'll develop terrible habits.

 

Java is a good language to use to learn how to program, you don't have to worry about things like memory management, and pointers are used automatically. You could call it a fool proof language really. However, your goal shouldn't be to learn Java, it should be to learn how to program in general. That way you'll very easily be able to pick up other languages latter on and essentially do whatever you want. You'll be less likely to pick up bad habits as well if you go about it that way. Think of Java more as the tool you use to learn concepts that can be applied with anything. Even though you don't have to learn about things like memory management and pointers if you're just learning Java, keep in mind that its a very good idea to learn how they factor into Java, as it will give you a much better understanding of how things work, and will allow you to write better code.

 

That all said, I can't really recommend a specific book, as I didn't learn from one.

 

A lot of people recommend SICP (http://mitpress.mit.edu/sicp/) though, although I think it uses Lisp, not Java. I could certainly recommend a few books latter on for learning things like data structures and stuff like that, but that sort of stuff is more advanced.

Share this post


Link to post
Share on other sites
A lot of people recommend SICP (http://mitpress.mit.edu/sicp/) though, although I think it uses Lisp, not Java.

 

That seems to be a terrific lecture if you're a computer scientist or want to become one, but it might be quiet out of the scope if you just want to learn some basic object-orientated programming. I just skipped through some pages and it seems to focus very much on theoretical problems and aspects of programming. And it's Lisp, which isn't inherently a bad thing, but also very "alien" in concept compared to the most common modern object orientated languages.

 

It's sound advice to say he should generally learn programming, not Java, but I wouldn't recommend to start from there.

Share this post


Link to post
Share on other sites

I learned Java in my 1st year of university. The recommended textbook was called Objects First with Java and was really helpful when I was learning. It also uses the development program called BlueJ which I found as a good stepping stone before using Eclipse. If you already have programming experience then you could probably head straight for Eclipse.

Share this post


Link to post
Share on other sites

General reply to all as I'm too lazy to quote.

 

I haven't really set goals or anything at the moment. I'm in the 'research stage' really. Yeah Android apps (I prefer Android, alright @Wesley? :p( would be a nice end goal but I am thinking "I want to learn Java". I see what you're saying though @Emasher and it does kind of feed into what I said this morning; I need to learn how to program and then learn the languages rather than I need to learn the languages to learn how to program. I'm realising that :)

 

Thanks for the advice everyone :) I picked up a book on UI today as it came highly recommended ('Don't Make Me Think') and plan to finish that by the weekend and then on the weekend I can start thinking properly about programming (as I don't really have much time in the evenings this week). I've also looked at the library at work and there's a fairly good programming section so will pilfer that. Plus I have added myself to the programming modules so hopefully they put notes on Blackboard that I can take ;)

 

Will undoubtedly end up using this as a problem thread :p

 

Oh BTW how useful is knowing web languages? I'm not an expert on any particular one but I can read and understand HTML, CSS and PHP most of the time and have a very basic grasp of ActionScript.

Share this post


Link to post
Share on other sites

Weren't you going to learn MEL a while ago?

 

Or was that someone else...

Share this post


Link to post
Share on other sites

I think I expressed an interest in it as I was doing the whole animation thing (or I may have been trying to do a specific thing) but I don't think I ever said "I AM GOING TO LEARN MEL" with my hands on my hips and my chin thrust skyward.

Share this post


Link to post
Share on other sites

Don't start with UI stuff. Especially if you're going to be using Java (both Swing and AWT(as far as GUI stuff goes), Java's GUI libraries, are terrible). Start with simple command line applications and then look at GUI libraries once you're a lot more comfortable with Java.

 

As far as development environments go, BlueJ is okay for beginners, but its only better in that the other full IDEs because it has very few features. Another IDE designed for beginners is Dr. Java. I've never used it though. Personally though, I would recommend Notepad++ (Windows) or Smultron (OS X) for coding, and just using the command line to compile and run stuff.

 

To do this, once you've installed both the JRE and the JDK, you just navigate to the directory where your program is and type:

 

javac *.java

 

and then:

 

java *name of the class with your main method*

 

to run your program.

 

Its simple, and gets rid of all the bullshit you have to deal with when using IDEs, which are more for serious development.

 

As far as web languages go, HTML and CSS will not help at all. If you know some of the programming aspects of PHP and actionscript, like variables and control structures, you may have a slight advantage over someone who's never seen code before.

 

And just for reference, here's a list of topics to learn about:

 

Absolutely need to learn:

 

-The main method

-Console input and output

-primitive type variables (boolean, byte, int, char, long, float, double)

-static, final, private, public, protected, etc.

-commenting

-control structures (if statements, loops, etc.)

-arrays (don't bother with dynamic arrays for now though)

-methods

-classes, constructors, instance variables, objects, pointers, etc.

-Strings (and string manipulation)

 

Will probably be useful latter on:

 

-Basic data structures (primarily linked lists)

-Time complexity (just the basics)

-Basic ADTs (stacks, queues, etc.)

-programming standards

-Understanding what the garbage collector does

 

Useful for java development:

 

Java libraries (lang, math, awt, swing, io, etc.)

Generic typing

 

Any good book should go through at least everything on the first list.

Share this post


Link to post
Share on other sites

I'm not "starting with UI stuff". I just happen to be reading a book about UI as it was recommended to me and I found it in the library earlier. It's about websites and I'm thinking more about this place/other projects rather than this. I was just rambling earlier.

Share this post


Link to post
Share on other sites

From my education I didn’t finish, I have Introduction to Java programming by Y. Daniel Liang. From time to time I like to pick it up again, like now coincidently, trying my hand again at GUI stuff. Current edition is the 8th, but apparently there should be a 9th edition available soon, so look out for that one.

 

I like it because it really tries to teach all the basic concepts, from the beginning. The simple procedural stuff first, then the OO stuff etc. I especially like how it has simple notes that regularly explain what you were wondering about, or simply say the thing you’re wondering about will be explained in future chapters, or repeat stuff you didn’t realise applied to the regarding example.

 

I’m simply using the console by the way. No IDEs yet for me.

Share this post


Link to post
Share on other sites
I think I expressed an interest in it as I was doing the whole animation thing (or I may have been trying to do a specific thing) but I don't think I ever said "I AM GOING TO LEARN MEL" with my hands on my hips and my chin thrust skyward.

 

But that's how I imagine you saying everything.

Share this post


Link to post
Share on other sites

The first Java book I used in my first year was Java Concepts by Cay S. Horstmann. I find it hard to recommend a particular method of learning, as I've been coding in Java for over 4 years... A book I would highly recommend trying is Head First Java, O'Reilly Media. The Head First series is meant to be excellent, I read the Design Patterns one but surely the Java one should be just as good.

 

Learn by writing actual code, doing exercises online...use Stack Overflow and Google things heavily. Maybe get a coder friend to give you a crash course...it depends on how intuitive you find it, really. Java Concepts would be a solid book to start with.

 

Alternative languages to launch yourself into programming with are C++, Ruby (on Rails for web app development), and Python. Java is very very useful though.

 

Start with coding in Notepad and using the command line to compile and execute. After you write your first class, move onto an IDE - I use Eclipse. Netbeans is another choice, but I prefer Eclipse (Netbeans has a better GUI editor though).

 

Feel free to ask me to clarify anything I've said above! @heroicjanitor might have some good advice, too.

Share this post


Link to post
Share on other sites

Cheers. I'm sure I'll be bugging you both ^_^

 

Actually @Emasher and @EddieColeslaw any books you recommend (I do see you've recommended one Eddie)? The work library seems to have a decent collection so can always take advantage of that.

Share this post


Link to post
Share on other sites

  • Java Concepts by Cay S. Horstmann
  • Head First Java, O'Reilly Media

 

Start with those for a good foundation, then move onto using the web as your main resource - no one learns to code practically from reading books or sitting in lectures. I personally learned the most during college projects and my internship. Look at tutorials, write the code out yourself, hack and change it...Google for things you want to make or implement and hack away at it :) Good luck!

 

Roseindia is good for tutorials and code samples.

 

The Java API will be your main resource for now.

 

This is a good page of exercises to do when you get past basic/intermediate level - bookmark! http://www.home.hs-karlsruhe.de/~pach0003/informatik_1/aufgaben/en/java.html

Share this post


Link to post
Share on other sites
Cheers. I'm sure I'll be bugging you both ^_^

 

Actually @Emasher and @EddieColeslaw any books you recommend (I do see you've recommended one Eddie)? The work library seems to have a decent collection so can always take advantage of that.

 

Like I said, I didn't learn Java from a book, so I can't recommend any one book. A place to start might be looking at some of the more prestigious universities that teach their introductory CS courses in Java and see what books they use.

 

I've learned most of what I know from courses (I'm a computer science student) as well as working on my own projects, which is nice, but if you don't have access to something like that, books seem to be the next best thing. Video tutorials can be good as well, so perhaps give YouTube a visit.

Share this post


Link to post
Share on other sites

I can't give much more advice than has already been said, the guys above have it covered :p

 

Start with a "Hello World!" tutorial. This will run a program that prints "Hello World!" to the screen, and is traditionally the first thing anyone writes in a new language. It shows how to get a program running, it shows how to print to output, it shows the syntax of methods (usually). Printing out things to the screen to check results is hugely helpful, and the descriptions in the tutorials for these are usually straightforward.

 

My main advice would be to stick at it, errors are good, you learn far more when you are making mistakes in a language than when you are sticking to some rigid guide. Finding out why you were wrong is hugely important and it guides you in future.

 

When you find something new, try to write something small which makes use of it. It sticks much better that way. Start small but don't be afraid to try something just to see if it works, and keep at it! If you get any error messages you can ask here and I'm sure someone will explain :)

Share this post


Link to post
Share on other sites

Yeah having dabbled in a few things I've done "Hello World" a lot. Led to an idea: one day I want to write a [insert media here] in which a programmer decides to end it all and just leaves the note "Goodbye World".

Share this post


Link to post
Share on other sites

×