Head First Java 2 Edition

Head First Java 2 Edition  (English, Paperback, Kathy Sierra)

1,992 Ratings & 260 Reviews
4% off
  • Bank OfferExtra 5% off* with Axis Bank Buzz Credit Card
  • Delivery
    Enter pincode
      Usually delivered in4-5 days
      Enter pincode for exact delivery dates/charges
    View Details
    Read More
    • Language: English
    • Binding: Paperback
    • Publisher: O' Reilly
    • ISBN: 9788173666025, 8173666024
    • Edition: 2, 2005
    • Pages: 730
    • 10 Days Replacement Policy
    • Cash on Delivery available
    • 10 Days Replacement Policy
  • View more sellers starting from 750
  • Description
    This is a book that is tailored for Java novices. Ideal for those who are interested in learning Java but have been put off by the complexities of learning the language, Head First Java explores a new way of teaching the same.

    Head First Java is aimed at people who are complete novices when it comes to programming with the language, and the book makes the learning experience fun - one thats filled with innovative and novel measures.

    If youre not a fan of wracking your brain with dull theoretical concepts that put you to sleep, Head First Java can be a welcome addition to your shelf.

    The book starts from the fundamentals and progresses to extremely advanced levels, employing an easy-to-learn approach throughout. From distributed programming with RMI and network sockets, object oriented design, and object properties and methods, to graphical user interfaces, Java archives, network connectivity and Java 5.0, the book explores every facet of the programming language with mysteries, puzzles and visuals that will keep you engaged.

    The unusual format is based on the theory that the brain needs stimulation to grasp complex issues. The adopted approach brings about a considerable reduction in the time required to grasp the language.

    About The Author
    Kathy Sierra is a well-known game developer and programming inspector. She has worked as a master trainer for Sun Microsystems. Shes also one of the founders of JavaRanch, the online community of Java programmers.

    Other books of hers that shes co-authored with Bert Bates include
    • Head First Design Patterns
    • Head First EJB
    • Head First Servlets and JSP

    Bert Bates has been involved in the area of software development for more than 25 years. He has been the lead developer for many Java certification exams. He is also a consultant in the area of artificial intelligence. He has co-authored the Head First series of books with Kathy Sierra.

    Table Of Contents
      I Breaking the Surface: a quick dip
      2 A Trip to Objectville: yes there will be Object
      3 Know Your Variables: primitives and references
      4 How Objects Behave: object state affects method &Junior
      5 Extra-Strength Methods: flow control operations, and more
      6 Using the Java Library: so you don't have to write it all yourself
      7 Better Living in Objectville: planning for the future
      8 Serious Polymorphism: exploiting abstract Classes and interfaces
      9 Life and Death of an Object: constructors and memory management
      10 Numbers Matter: math, formatting, wrappers; and statics
      11 Risky Behavior: exception handing'
      12 A Very Graphic Story: intro to GUI, event handling, and inner classes
      13, Work on Your Swing: layout managers to subcomponents
      14 Saving Object: serialization and I/0
      15 Make a Connection: networking sockets and multi-threading
      16 Data Structures: collections and genetics
      17 Release Your Code: packaging and deployment
      18 Distributed Computing: RMI with a dash of serialize, EJE, and Jini
      Appendix A: Fatal code kitchen
      Appendix B: To 7th Mugs that &diet make it into the rest of the book
    Read More
    Book Details
    Publication Year
    • 2005
    Table of Contents
    • Chapter 1 Dive in A Quick Dip: Breaking the Surface

      • The Way Java Works
      • What you’ll do in Java
      • A very brief history of Java
      • Code structure in Java
      • Anatomy of a class
      • Writing a class with a main
      • Looping and looping and...
      • Conditional branching
      • Coding a Serious Business Application
      • Phrase-O-Matic

      Chapter 2 Classes and Objects: A Trip to Objectville

      • Chair Wars: (or How Objects Can Change Your Life)
      • Making your first object
      • Making and testing Movie objects
      • Quick! Get out of main!
      • Running the Guessing Game

      Chapter 3 Primitives and References: Know Your Variables

      • Declaring a variable
      • “I’d like a double mocha, no, make it an int.”
      • You really don’t want to spill that...
      • Back away from that keyword!
      • This table reserved
      • Controlling your Dog object
      • An object reference is just another variable value
      • An array is like a tray of cups
      • Arrays are objects too
      • Make an array of Dogs
      • Control your Dog (with a reference variable)
      • A Dog example

      Chapter 4 Methods Use Instance Variables: How Objects Behave

      • Remember: a class describes what an object knows and what an object does
      • The size affects the bark
      • You can send things to a method
      • You can get things back from a method
      • You can send more than one thing to a method
      • Java is pass-by-value. That means pass-by-copy
      • Cool things you can do with parameters and return types
      • Encapsulation
      • Encapsulating the Good Dog class
      • How do objects in an array behave?
      • Declaring and initializing instance variables
      • The difference between instance and local variables
      • Comparing variables (primitives or references)

      Chapter 5 Writing a Program: Extra-Strength Methods

      • Let’s build a Battleship-style game: “Sink a Dot Com”
      • First, a high-level design
      • The “Simple Dot Com Game” a gentler introduction
      • Developing a Class
      • The check Yourself method
      • The game’s main method
      • More about for loops
      • Trips through a loop
      • The enhanced for loop
      • Casting primitives

      Chapter 6 Get to Know the Java API: Using the Java Library

      • In our last chapter, we left you with the cliff-hanger. A bug
      • So what happened?
      • How do we fix it ?
      • Option one is too clunky
      • Option two is a little better, but still pretty clunky
      • Wake up and smell the library
      • Some things you can do with Array List
      • Comparing Array List to a regular array
      • Comparing Array List to a regular array
      • Let’s fix the Dot Com code
      • New and improved Dot Com class
      • Let’s build the REAL game: “Sink a Dot Com”
      • What needs to change?
      • Who does what in the Dot Com Bust game (and when)
      • Prep code for the real Dot Com Bust class
      • The final version of the Dot Com class
      • Super Powerful Boolean Expressions
      • Using the Library (the Java API)
      • How to play with the API

      Chapter 7 Inheritance and Polymorphism: Better Living in Objectville

      • Chair Wars Revisited...
      • Let’s design the inheritance tree for an Animal simulation program
      • Using inheritance to avoid duplicating code in subclasses
      • Do all animals eat the same way?
      • Looking for more inheritance opportunities
      • Designing an Inheritance Tree
      • When designing with inheritance, are you using or abusing?
      • Keeping the contract: rules for overriding
      • Overloading a method

      Chapter 8 Interfaces and Abstract Classes: Serious Polymorphism

      • Did we forget about something when we designed this?
      • Interface to the rescue!
      • Making and Implementing the Pet interface

      Chapter 9 Constructors and Garbage Collection: Life and Death of an Object

      • The Stack and the Heap: where things live
      • Methods are stacked
      • What about local variables that are objects?
      • If local variables live on the stack, where do instance variables live?
      • The miracle of object creation
      • Construct a Duck
      • Initializing the state of a new Duck
      • Using the constructor to initialize important Duck state Not to imply that not all Duck state is not unimportant.
      • Make it easy to make a Duck
      • Doesn’t the compiler always make a no-arg constructor for you? No!
      • Nanoreview: four things to remember about constructors
      • Wait a minute... we never DID talk about super-classes and inheritance and how that all fits in with constructors
      • The role of superclass constructors in an object’s life
      • Making a Hippo means making the Animal and Object parts too...
      • How do you invoke a superclass constructor?
      • Can the child exist before the parents?
      • Superclass constructors with arguments
      • Invoking one overloaded constructor from another
      • Now we know how an object is born, but how long does an object live?
      • What about reference variables?

      Chapter 10 Numbers and Statics: Numbers Matter

      • MATH methods: as close as you’ll ever get to a global method
      • The difference between regular (non-static) and static methods
      • What it means to have a class with static methods
      • Static methods can’t use non-static (instance) variables!
      • Static methods can’t use non-static methods, either!
      • Static variable: value is the same for ALL instances of the class
      • Initializing a static variable
      • static final variables are constants
      • final isn’t just for static variables...
      • Math methods
      • Wrapping a primitive
      • Before Java 5.0, YOU had to do the work...
      • Autoboxing: blurring the line between primitive and object
      • Autoboxing works almost everywhere
      • But wait! There’s more! Wrappers have static utility methods too!
      • And now in reverse... turning a primitive number into a String
      • Number formatting
      • Formatting deconstructed...
      • The percent (%) says, “insert argument here” (and format it using these instructions)
      • The format String uses its own little language syntax
      • The format specifier
      • The only required specifier is for TYPE
      • What happens if I have more than one argument?
      • So much for numbers, what about dates?
      • Working with Dates
      • Moving backward and forward in time
      • Getting an object that extends Calendar
      • Working with Calendar objects
      • Highlights of the Calendar API
      • Even more Statics!... static imports

      Chapter 11 Exception Handling: Risky Behavior

      • Let’s make a Music Machine
      • We’ll start with the basics
      • First we need a Sequencer
      • The compiler needs to know that YOU know you’re calling a risky method
      • An exception is an object... of type Exception
      • If it’s your code that catches the exception, then whose code throws it?
      • Flow control in try/catch blocks
      • Finally: for the things you want to do no matter what
      • Did we mention that a method can throw more than one exception?
      • Exceptions are polymorphic
      • Multiple catch blocks must be ordered from smallest to biggest
      • You can’t put bigger baskets above smaller baskets
      • When you don’t want to handle an exception...
      • Ducking (by declaring) only delays the inevitable
      • Getting back to our music code...
      • Making actual sound
      • Your very first sound player app
      • Making a Midi Event (song data)
      • MIDI message: the heart of a Midi Event
      • Change a message

      Chapter 12 Getting GUI: A Very Graphic Story

      • It all starts with a window
      • Your first GUI: a button on a frame
      • But nothing happens when I click it...
      • Getting a user event
      • Listeners, Sources, and Events
      • Getting back to graphics...
      • Make your own drawing widget
      • Fun things to do in paint Component
      • Behind every good Graphics reference is a Graphics2D object
      • Because life’s too short to paint the circle a solid color when there’s a gradient blend waiting for you
      • We can get an event. We can paint graphics. But can we paint graphics when we get an event?
      • GUI layouts: putting more than one widget on a frame
      • Let’s try it with TWO buttons
      • So now we need FOUR widgets
      • And we need to get TWO events
      • Inner class to the rescue!
      • An inner class instance must be tied to an outer class instance There’s an exception to this, for a very special case—an inner class defined within a static method. But we’re not going there, and you might go your entire Java life without ever encountering one of these.
      • How to make an instance of an inner class
      • Using an inner class for animation
      • Listening for a non-GUI event
      • An easier way to make messages / events

      Chapter 13 Using Swing: Work on Your Swing

      • Swing components
      • Layout Managers
      • How does the layout manager decide?
      • The Big Three layout managers: border, flow, and box
      • Playing with Swing components
      • Making the Beat Box

      Chapter 14 Serialization and File I/O: Saving Objects

      • Capture the Beat
      • Saving State
      • Writing a serialized object to a file
      • Data moves in streams from one place to another
      • What really happens to an object when it’s serialized?
      • But what exactly IS an object’s state? What needs to be saved?
      • If you want your class to be serializable, implement Serializable
      • Deserialization: restoring an object
      • What happens during deserialization?
      • Saving and restoring the game characters
      • Writing a String to a Text File
      • Text File Example: e-Flashcards
      • Quiz Card Builder (code outline)
      • The java.io. File class
      • Reading from a Text File
      • Quiz Card Player (code outline)
      • Parsing with String split
      • Version ID: A Big Serialization Gotcha
      • Using the serial Version UID
      • Saving a Beat Box pattern
      • Restoring a Beat Box pattern

      Chapter 15 Networking and Threads: Make a Connection

      • Real-time Beat Box Chat
      • Connecting, Sending, and Receiving
      • Make a network Socket connection
      • A TCP port is just a number. A 16-bit number that identifies a specific program on the server
      • To read data from a Socket, use a Buffered Reader
      • To write data to a Socket, use a Print Writer
      • The Daily Advice Client
      • Daily Advice Client code
      • Writing a simple server
      • Daily Advice Server code
      • Writing a Chat Client
      • Java has multiple threads but only one Thread class
      • What does it mean to have more than one call stack?
      • Every Thread needs a job to do. A method to put on the new thread stack
      • To make a job for your thread, implement the Runnable interface
      • The Thread Scheduler
      • Putting a thread to sleep
      • Using sleep to make our program more predictable
      • Making and starting two threads
      • What will happen?
      • Um, yes. There IS a dark side
      • The Ryan and Monica problem, in code
      • We need the make Withdrawal  method to run as one atomic thing
      • Using an object’s lock
      • The dreaded “Lost Update” problem
      • Let’s run this code...
      • Make the increment method atomic. Synchronize it!
      • The deadly side of synchronization
      • New and improved Simple Chat Client
      • The really really simple Chat Server

      Chapter 16 Collections and Generics: Data structures

      • Tracking song popularity on your jukebox
      • Here’s what you have so far, without the sort:
      • But the Array List class does NOT have a sort method!
      • Array List is not the only collection
      • You could use a Tree Set... Or you could use the Collections.sort method
      • Adding Collections.sort to the Jukebox code
      • But now you need Song objects, not just simple Strings
      • Changing the Jukebox code to use Songs instead of Strings
      • It won’t compile!
      • Generics means more type-safety
      • Learning generics
      • Using generic CLASSES
      • Using type parameters with Array List
      • Using generic METHODS
      • Here’s where it gets weird...
      • Revisiting the sort method
      • In generics, “extends” means “extends or implements”
      • Finally we know what’s wrong...
      • The new, improved, comparable Song class
      • We can sort the list, but...
      • Using a custom Comparator
      • Updating the Jukebox to use a Comparator
      • Uh-oh. The sorting all works, but now we have duplicates...
      • We need a Set instead of a List
      • The Collection API (part of it)
      • Using a Hash Set instead of Array List
      • What makes two objects equal?
      • How a Hash Set checks for duplicates: hash Code and equals
      • The Song class with overridden hash Code and equals
      • And if we want the set to stay sorted, we’ve got Tree Set
      • What you MUST know about Tree Set...
      • Tree Set elements MUST be comparable
      • We’ve seen Lists and Sets, now we’ll use a Map
      • Finally, back to generics
      • Using polymorphic arguments and generics
      • But will it work with Array List (Dog) ?
      • What could happen if it were allowed...
      • Wildcards to the rescue
      • Alternate syntax for doing the same thing

      Chapter 17 Package, Jars and Deployment: Release Your Code

      • Deploying your application
      • Imagine this scenario...
      • Separate source code and class files
      • Put your Java in a JAR
      • Running (executing) the JAR
      • Put your classes in packages!
      • Preventing package name conflicts
      • Compiling and running with packages
      • The -d flag is even cooler than we said
      • Making an executable JAR with packages
      • So where did the manifest file go?
      • Java Web Start
      • The .jnlp file

      Chapter 18 Remote Deployment with RMI: Distributed Computing

      • Method calls are always between two objects on the same heap
      • What if you want to invoke a method on an object running on another machine?
      • Object A, running on Little, wants to call a method on Object B, running on Big
      • But you can’t do that
      • The role of the ‘helpers’
      • Java RMI gives you the client and service helper objects!
      • How does the client get the stub object?
      • How does the client get the stub class?
      • Be sure each machine has the class files it needs
      • Yeah, but who really uses RMI?
      • Appendix Final Code Kitchen
      • Final Beat Box client program
      • Final Beat Box server program

      Appendix The Top Ten Topics that almost made it into the Real Book...

      10 Bit Manipulation
      9 Immutability
      8 Assertions
      7 Block Scope
      6 Linked Invocations
      5 Anonymous and Static Nested Classes
      4 Access Levels and Access Modifiers (Who Sees What)
      3 String and String Buffer/String Builder Methods
      2 Multidimensional Arrays
      And the number one topic that didn’t quite make it in...
      1 Enumerations (also called Enumerated Types or Enums)

      Appendix This isn’t goodbye

    Authored By
    • Kathy Sierra
    University Books Details
    • Computer Science Engineering
    • 4th Semester
    Frequently Bought Together
    Head First Java 2 Edition
    4% off
    1 Item
    2 Add-ons
    Ratings & Reviews
    1,992 Ratings &
    260 Reviews
    • 5
    • 4
    • 3
    • 2
    • 1

    Best book for Java Greenhorns.

    I am final year student of B.Tech CSE. I have programming experience in C# .Net 3.5 , C and C . Further, I kind of had feeling that I should resign from .Net and choose Java. So, after a lot R&D on Google and some other tech forums I chose Head First Java. And all I can say now is that it's simply awesome for newbies in Java. One can never find it boring. Once u have came past 1st chapter it will generate curiosity and u will keep moving on. I finished this book in mere 15-20 days and now I ...

    Lavakesh Pandey

    Dec, 2011

    Report Abuse

    Great one for Beginners

    I would say its a great book for Beginners! Neatly explained OO Concepts and java basics. Not recommened for ppl who are already familiar with Java.

    Mohamed Sanaulla

    Dec, 2009

    Report Abuse


    First of all FK Delivery ,
    I used to be fan of FK for its delivery but this time they took six days,
    it seems they are more on promoting IN-A-DAY service .so that 3 stars.
    About the book ,
    i would have given it a 4 stars for its interactive and engaging style of presentation.
    if you are impressed with many 5 stars from other users bear in mind you are not going to become an expert in java with this one.
    This book is intended to the Beginners ,(though helpful to experts as well).
    It feels lik...

    Shital Kumar Jha

    Certified Buyer, Bangalore

    Jan, 2014

    Report Abuse

    From a Procedural Programmer to Object Oriented Guy!

    In my last career job that I left about 20 years ago we were programming in DOS world using C & Assembly. Since then I spent years teaching computers to children of all ages. I had a longstanding desire to be able to bring myself up to speed in today's PC environments. My 1st book in Python was too overwhelming. I read the reviews here and thought to try this book. I can tell you that it has made OOPS funda a lot more clear for me. Went through about 150 pages of it like I was reading a novel...

    Paresh Kapadia

    Certified Buyer

    Apr, 2012

    Report Abuse

    good book...bad quality

    I order this book because when I took it for first time from a friend, I just wasn't able keep it away and I definitely wanted to keep a copy of this in my collection. The book is a MUST for first time JAVA divers. But the quality of the book is bad. Seriously you can actually see the next page from the current page. The paper used to print is so thin, that I cannot even highlight with a smooth pencil, without tearing the paper. I wonder if Flipkart is listening.


    Jan, 2012

    Report Abuse

    Good quality product

    Today I received this book.whenever's I opened this book the way of explanation of this book is good .this book totally explained by picture format.it's easy to understand every concept in java....
    finally I was satisfied with Head First java and flipkart also provided with in delivery time.
    paper quality little bit delicate not more just slightly delicated(but we can read the everything clearly)

    Flipkart Customer

    Certified Buyer, Hyderabad

    11 months ago

    Report Abuse

    Best in the market!

    book is just awesome

    navneet kumar Choudhary

    Certified Buyer, Darbhanga

    11 months ago

    Report Abuse

    Want to answer every question in class and make heads turn? THEN READ THIS BOOK!

    This is an extremely good book for anybody who wants to begin their learning on Java.
    1. Fluid style
    2. Clever illustrations
    3. Interesting problems
    4. Unconventional coding (no programming involving printing the sum of two numbers)
    5. You'd probably learn something out of this and still be called cool.

    Since it is a beginner's book, there are some limitations regarding the amount of learning you would like to have. There is only one con: Less detailed chapters on Autoboxing, Swi...

    Dev Sengupta

    Certified Buyer, English Bazar

    Sep, 2014

    Report Abuse

    Java made in to a-walk-in-a-park for beginners

    I'm a amateur programmer. I had little programming knowledge in C. I've never passed across chapter 3 in any book. But this one is different. Without even realizing I've learned a lot within two weeks of starting to studying this.

    Initially I thought of learning the basics of some robust programming language. From my research over internet I zeroed in on Java. Then I researched further on learning Java. All the suggestions I got is to start with 'Head First Java' and then 'Head First Design...

    Rajarajan Panneerselvam

    Oct, 2011

    Report Abuse

    Perhaps the best Java for beginners

    This is perhaps the best book for beginners who want to learn Java basics. It pictorially explains the technical concepts in non-technical, which beginners will find very hard to understand otherwise. Even most of the teachers won't be able to explain the concepts better than this book can. Reading the initial pages of the book, you can find how much research has been put into developing this sort of teaching methodology. Being myself a lecturer, I do recommended this book, especially for th...

    Kumar Kush

    Oct, 2011

    Report Abuse
    All 260 reviews
    Questions and Answers
    Q:Is it a book for a first year CSE student... ?!?
    A:Anybody can learn java from this book.This is beginner book for java.Doesn't matter if java is in your any semester or year.If you want to learn java then you can read this book.
    Flipkart User
    Certified Buyer
    Report Abuse
    Read other answers
    Q:Does the basic knowledge of Java is in the book? 1.How to programme,compile That make a student understand about Java programming
    A:Yes it have everything from A to Z of Java
    Flipkart User
    Certified Buyer
    Report Abuse
    Q:are there explain programs on java??
    A:There are many working programs in java with detailed explaining
    Sumanth S
    Certified Buyer
    Report Abuse
    Read other answers
    Q:What is the latest edition of head first Java??
    A:2nd edition
    Tanishq Singh
    Certified Buyer
    Report Abuse
    Q:is there all opps concepts of java in this book?. Answer me
    Certified Buyer
    Report Abuse
    Q:what is the font size in a book
    Ilyas Shareef
    Certified Buyer
    Report Abuse
    Read other answers
    Q:Do this book have latest Java version?
    A:Yes, its of latest version. And yes latest version means it has all the keywords or contents that are being used now. Hope u got your answer!
    Certified Buyer
    Report Abuse
    Q:Is it a book for a student of class 9 i.e. me?
    Certified Buyer
    Report Abuse
    Read other answers
    Q:I am intermediate java programmer Can i write advanced progrming by this book
    A:No.You can write basic programs by reading this book and maybe you can understand advanced programs when you read them. Also the Book doesn’t cover java 8
    sameer mishra
    Certified Buyer
    Report Abuse
    Q:i want java 1.8 ?
    A:As per my knowledge this is the latest version of this book. If you want 1.8 then you can look for the book by oracle
    Flipkart Customer
    Certified Buyer
    Report Abuse
    Didn't get the right answer you were looking for
    Safe and Secure Payments.Easy returns.100% Authentic products.
    Back to top