aspose file tools*
The moose likes Beginning Java and the fly likes A Java Newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A Java Newbie" Watch "A Java Newbie" New topic
Author

A Java Newbie

Neeraj Rawat
Greenhorn

Joined: May 03, 2011
Posts: 5
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

I also read here

http://java.sun.com/docs/white/langenv/

that we dont have Enums and operator overloading in Java but still have seen many discussion for queries like that even here in coderanch saw a thread discussing enums
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36579
    
  16
Welcome to the Ranch

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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9994
    
    7

I found the Herbert Schildt book not that up to the mark. I felt it had a style which was hurrying you along.
Based on experience, I would recommend Core Java by Horstmann and Cornell.

Almost all of the questions you have asked would require a detailed explanation (consider your basic learning stage) and I would really recommend you get yourself a book or check out http://download.oracle.com/javase/tutorial/java/index.html and http://download.oracle.com/javase/tutorial/


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

Welcome to the Ranch!

That's a lot of questions for one topic.

Neeraj Rawat wrote:What is Abstract class and wrapper class??

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36579
    
  16
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
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
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.
jake dickens
Ranch Hand

Joined: Mar 23, 2011
Posts: 30
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

I also read here

http://java.sun.com/docs/white/langenv/

that we dont have Enums and operator overloading in Java but still have seen many discussion for queries like that even here in coderanch saw a thread discussing enums





Good book to get into for beginner is Head First Java breaks it down and easy to understand, also it has puzzles, questions and more.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Java Newbie
 
Similar Threads
Gave the exam
oops in real time
oops concept clarification
a very Basic OOP Doubt
Object "Savvy"