A Java Newbie

Hey friends can you tell me a good book for Java which has detail explanation with good examples and few questions at the end of every topic for practice with solutions.

And I have few queries can you please explain with example: ( If you dont mind answering them with examples meaning codes or simply give me some links with codes of all that )

What is the difference in abstraction & encapsulation (with examples in code )?what is data and code as seen many sites that wrapping up of data and code in a class is encapsulation then by that data it means data type?

What is Abstract class and wrapper class??

Example of polymorphism?how many type of polymorphism do we have in java?

Examples of inheritance and their types?

what is friend function and virtual function?Or we dont have any in java?We have methods in java so do we have friend method or virtual method?

I have read at many forums that Herbert Schildt complete reference for Java is not a good book to read ???Is it true??This forum has the best rank for JAVA so asked the questions here however I am still searching all over google but getting many confusing answers

That white paper makes fascinating reading about the history of Java™, but it is 15 years old, so a lot has changed in the language since it was written. Enumerated types included.
I would suggest you go to a library and look through the Java™ books they have there, and see which you like. Also go through our book reviews pages. I like the Deitel books, but many people really dislike the style. So you want to find somewhere to read a few pages before you think of buying anything. If you buy a Deitel book, get ≥6th edition, and I prefer the "early objects" versions. The "How to" books have lots of exercises in, but mostly not "answers". Another book which is rightly popular is Head First Java™: get the 2nd edition.

I am not familiar with Schildt's books. The pages visible on Amazon do not help assess the book at all.

There is no such thing as friend in Java™, nor a virtual keyword.
I'll let somebody else answer your other questions.

An abstract class is a class declared with the abstract method. It's an "incomplete" class - you can't create objects from an abstract class, it is meant to be subclassed. See Abstract Methods and Classes in Oracle's excellent Java Tutorials for more detailed information.

Wrapper classes are classes that are just containers for simple values and don't do much else. In Java, there are wrapper classes for the primitive types: for example there's class java.lang.Integer for int, java.lang.Long for long, java.lang.Character for char, etc. These are necessary because sometimes you need an object, and values of primitive types (int, long, char, ...) are not objects in Java. For example, Java's collection classes (ArrayList, HashMap, ...) can only store objects.

Neeraj Rawat wrote:what is friend function and virtual function?Or we dont have any in java?We have methods in java so do we have friend method or virtual method?

Those are terms from the C++ programming language. First of all, in Java we call them methods instead of functions. Friend functions (or methods) don't exist in Java; that's a C++ feature. Also, there's no "virtual" keyword in Java, as in C++. In Java, all non-static methods can be overridden - so, comparing it to C++, you could say that (non-static) methods in Java are always virtual.

Neeraj Rawat wrote:What is the difference in applet and servlet ?

An applet is a small Java program that runs inside a web browser. A servlet is a piece of code that runs on a web server and that handles HTTP requests coming from web browsers. The big difference is that an applet runs on a user's own computer, while a servlet runs on the web server. These are Java EE topics. I suggest you first learn the basics of the Java programming language itself very well before trying to learn Java EE - because that's a big and complicated topic on its own.

Neeraj Rawat wrote:What is the difference in AWT and swing?

AWT was Java's original GUI toolkit (which already existed in Java version 1.0). Swing was added in Java 1.2 (also a very long time ago). The biggest difference between the two is that AWT uses native GUI components (buttons, lists, dropdown boxes etc.) of the underlying operating system, while Swing does not - it has its own GUI components that are independent of the operating system. That has a number of advantages, for example the look-and-feel of components can be customized with Swing much more than with AWT.

Oracle's Java Tutorials contain a lot of useful information to learn about many different Java language features and technologies.

Horstmann and Cornell is probably the best book I have read, but it isn't really a beginner's book. Since, however, you appear to have programmed a lot in C++, you are exactly the sort of person Horstmann and Cornell is intended for.

Neeraj Rawat
Greenhorn

Joined: May 03, 2011
Posts: 5

posted May 04, 2011 03:34:53

0

Thanks Campbell,Maneesh & Jesper.I have been reading the resources all night at oracle they are also good if one has no idea which one to read,atleast for me as I know a bit of programming and syntax of Java.And Jasper all those answers helped a lot making a clear understanding of the things.

@Maneesh

Yup I read Herbert Schildt but dint find many answers in it like type of polymorphism and atleast inheritance with all code examples.Actually I know a bit of c,c++ & java not much as read before but now I have my MCA viva on this sunday so need to revise a lot and time is less I was reading c from starting suddenly got the date.Now I need to learn the things in detail and till the time I dont make atleast a small software in c++,I will think I havent learnt programming lolz

@Campbell

Yes looking for Horstmann and Cornell ebook if will find good would purchase it then

Neeraj Rawat
Greenhorn

Joined: May 03, 2011
Posts: 5

posted May 07, 2011 16:49:01

0

Hey Campbell

I read few pages of Head First Java ebook,it seems to be very interesting book with so many pictures now need to find in a local store as cant read the ebook for so long sitting in front of computer.

Neeraj Rawat wrote:Hey friends can you tell me a good book for Java which has detail explanation with good examples and few questions at the end of every topic for practice with solutions.

And I have few queries can you please explain with example: ( If you dont mind answering them with examples meaning codes or simply give me some links with codes of all that )

What is the difference in abstraction & encapsulation (with examples in code )?what is data and code as seen many sites that wrapping up of data and code in a class is encapsulation then by that data it means data type?

What is Abstract class and wrapper class??

Example of polymorphism?how many type of polymorphism do we have in java?

Examples of inheritance and their types?

what is friend function and virtual function?Or we dont have any in java?We have methods in java so do we have friend method or virtual method?

What is the difference in applet and servlet ?

What is the difference in AWT and swing?

I have read at many forums that Herbert Schildt complete reference for Java is not a good book to read ???Is it true??This forum has the best rank for JAVA so asked the questions here however I am still searching all over google but getting many confusing answers