Hi all,
First I would like to say how much I like the forum.
I have recently started to program using Java and I have done a online tutorials from http://www.javavideotutes.com/home
and I now have a few questions:

1) What is a good book for me to get?

2) I have made a pythagoras theorem calculator and a celsuis to fahrenheit converter and am wondering what I should make next. So any suggestions would be greatly appreciated?

3) What is "switch" and "swing"

Thanks alot for any advice you can give me.
Dom

Good books... Dunno, but Lewis and Loftus was a reasonably good intro, covered the basics pretty well, and folded in the graphics part well. Very weak on the theory, but you'll want to get that later anyway.

Switch is a language construct, derived from C and probably earlier languages, which allows you to select a code path based on the value of a single variable. It's often compared to a chain of if/else if/else if statements, and that's a way to start understanding it, but it's not very precise in the long run.
For the moment, it's like this:

int q = someValueDerivedFromSomewhereElseInTheCode();

switch (q)
{
case 0: doStuffForZero();
        break;
case 1: doStuffForZero();
        break;
case 2: 
case 3: 
case 5: 
case 6: doStuffForTwoThreeFiveOrSixButNotFour();
        break;
case 4: fourIsASpecialCase();
        break;
default: sitInTheCornerAndSulk();
        break;
}

This exercises most of the interesting features of switch. Notice that cases "fall through" unless you have a break, so 2,3,5, and 6 all execute the same method. The "default" case is part of the language: if there's a default, it executes if none of the other cases are fired. Of course, if I'd omitted the break in case 4, you'd also execute the default.
I don't find switches teribly useful, but there are places where they come in handy.

Swing is the UI library built on top of the older Abstract Windowing Toolkit. Supposed to be easy to use, and certainly easier than writing your own graphics packages, but somewhat complex and idiosyncratic. Best way to learn it is to start with rote code and figure out what JFrames and JPanels and such do, and then dig in to the details.

Edited 6 Years Ago by jon.kiparsky: n/a

Books hmm lets see

i recommend "The complete reference java 7th edition- Herbert Schildt"
its nice and understandable by beginners and i think there is a thread for beginners already named Starting "Java" [Java tutorials / resources / faq] with lots of good stuff about books and tutorials http://www.daniweb.com/forums/thread99132.html

Edited 6 Years Ago by tizon: n/a

This article has been dead for over six months. Start a new discussion instead.