Answers.Body: <p>I'll try to give a few actual textbook recommendations.</p>
  <p>If the goal is to learn Java for regular programming, I would avoid like the plague any Java book that doesn't at least go through Java 5, at which point it practically became a different language.  I have always found David Liang to be quite a clear writer, and <a href="https://rads.stackoverflow.com/amzn/click/com/935306578X" rel="noreferrer" rel="nofollow noreferrer">his most recent text</a> (finally) introduces Java 5 features such as generics.</p>
  <p>If you're looking for a book that shows you the deeper beauty of object oriented programming, <a href="https://rads.stackoverflow.com/amzn/click/com/1940113059" rel="noreferrer" rel="nofollow noreferrer">Joseph Bergin's got your back</a>.  This isn't a book about Java features, but really more about the <em>why</em> of things.  Please note that after reading it, you will constantly run into people saying very silly things about OO online.  Many people really, really seem to think that they understand it because they have learned some of its mechanics, but they truly don't understand the core idea at all.</p>
  <p>In terms of more recent language features, I'm not familiar with this <a href="https://rads.stackoverflow.com/amzn/click/com/0134685997" rel="noreferrer" rel="nofollow noreferrer">book by Joshua Bloch</a>, but it is well reviewed, and covers far more recent developments than the Liang book.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T13:12:46.897Z
Answers.Text: Thanks for the help
Answers.UserDisplayName: Abhishek Ghosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T18:58:52.420Z
Answers.Text: Bloch's book is great.
Answers.UserDisplayName: ncmathsadist
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T12:50:52.840Z
Answers.LastActivityDate: 2020-07-06T12:50:52.840Z
Answers.UserDisplayName: Ben I.
Answers.Body: <p>For a student, any recent edition will be fine. Don't overthink it. The first task is to become thoroughly familiar with the mental model required of a Java programmer. Or even, for the very experienced, the mental model of a programmer in general.</p>
  <p>Most, but not all of the recent changes in Java are in the libraries, but even the more fundamental additions can wait until you can program effectively in <em>any consistent subset</em> of the language. The intimate details of most recent additions are much less important than gaining a facility with the ideas of abstraction, composition, inheritance, encapsulation, and such.</p>
  <p>And yes, the language will either continue to change or it will become obsolete. Don't worry about that until you can't solve some programming problem effectively with what you already know.</p>
  <p>And a good textbook is probably more valuable to you at this point than a reference in any case. Reference material tends to present features in isolation, which is essentially worthless. The features need to work together to be effective. Textbooks will tell you that better than a reference guide.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-05T20:02:30.413Z
Answers.Text: Thank you for the help. So please can you recommend me the textbook (with the edition) which you feel is the best.
Answers.UserDisplayName: Abhishek Ghosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-05T20:03:50.560Z
Answers.Text: Hmmm. The ones I wrote, of course. But it would be impossible for me to make a recommendation here. But if a book suggests that Circle is a subclass of Point, it is the wrong book and it will only lead you astray.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T15:11:56.793Z
Answers.Text: Depends how you're defining "recent", but lambdas, default methods, modules, type inference, switch expressions, text blocks, pattern matching, and records are all significant language additions.
Answers.UserDisplayName: OrangeDog
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T15:54:59.557Z
Answers.Text: Any recent edition may be fine, but the edition that the OP shows is *FAR* from recent. It predates the addition of Generics which is IMO one of the most significant changes in all of Java's history.
Answers.UserDisplayName: Peter Green
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-05T19:49:27.407Z
Answers.LastActivityDate: 2020-07-05T19:49:27.407Z
Answers.UserDisplayName: Buffy
Answers.Body: <p>The fundamental question is, whether your goal is to learn <em>programming</em> (in which case the language doesn't matter at all … theoretically at least) or to learn Java.</p>
  <p>If you want to learn programming, the programming language and the version doesn't really matter. It only matters insofar as to understand the examples, and to understand the concepts behind the code, you need to understand the programming language. So, the code and the programming language should be as simple as possible … e.g. a language like Scheme or Smalltalk, or you already need to know the language.</p>
  <p>If you want to learn Java, then you should use a recent book, because there has been a lot of stuff introduced that not only makes stuff easier to read and write, but that fundamentally changes the way Java programs are written.</p>
  <p>Sun dropped the &quot;2&quot; from &quot;Java 2&quot; in 2004. That should give you an indication as to how old this book is. It covers Java 2 1.4, which was released in 2002.</p>
  <p>You don't have to chase every version, every release, every edition, every new feature (especially with the new 6-month release cycle), but since 2002, there have been multiple new features in the Java language that <em>fundamentally change</em> how Java code is written:</p>
  <ul>
  <li>Java 5 (2004):
  <ul>
  <li><strong>Generics</strong></li>
  <li>Annotations</li>
  <li>Autoboxing/Autounboxing</li>
  <li><code>enum</code>s</li>
  <li>Varargs</li>
  <li>The enhanced <code>for</code> loop</li>
  <li>[LIB] JSR166 Concurrency APIs</li>
  </ul>
  </li>
  <li>Java 7 (2011)
  <ul>
  <li>[LIB] Extended JSR166 Concurrency APIs</li>
  <li>[LIB] NIO.2</li>
  </ul>
  </li>
  <li>Java 8 (2014)
  <ul>
  <li><strong>Lambdas</strong></li>
  <li><code>default</code> methods on <code>interface</code>s</li>
  <li>[LIB] <strong>The <code>Stream</code> API</strong></li>
  </ul>
  </li>
  <li>Java 9 (2017)
  <ul>
  <li><strong><code>module</code>s</strong></li>
  <li>[LIB] Reactive Streams</li>
  </ul>
  </li>
  <li>Java 10 (2018)
  <ul>
  <li>Local variable type inference</li>
  </ul>
  </li>
  <li>Java 14 (2020)
  <ul>
  <li><code>switch</code> expressions</li>
  </ul>
  </li>
  </ul>
  <p>[I <strong>bolded</strong> the ones I deem to be particularly disruptive. I marked some features as [LIB] which are <em>library additions to the Java platform</em> and not <em>language features</em>, but are nonetheless important. E.g. NIO.2 offers a whole new, much higher-level, much improved way of interacting with files. And <code>Stream</code>s essentially mean that you will never have to iterate over a collection ever again.]</p>
  <p><em>Value Types</em> and <em><code>sealed</code> Types</em> will bring another major shift in the near future (possibly as early as Java 15 (October 2020)). In particular, <code>sealed</code> Types will allow modeling <em>Algebraic Sum Types</em> in Java, which opens up a fundamentally different way of structuring programs.</p>
  <p>Oracle has recently started to include so-called <em>Previews</em> as well, these are features that are shipped as part of an official release, so they reach a wide audience, but that are not guaranteed to be supported in future releases in that form. They may be changed or dropped completely. One of those features is <code>record</code>s that currently ship as a preview in Java 14. While they aren't as disruptive as some of the others (Generics, lambdas, Value Types, <code>sealed</code>) as they are just syntactic sugar, they allow to drastically reduce the amount of code for simple data classes, and thus make it easier to see what is going on.</p>
  <p>For example, this:</p>
  <pre class="lang-java prettyprint-override"><code>final class Point {
      private final int x;
      private final int y;
  
      Point(int x, int y) {
          this.x = x;
          this.y = y;
      }
  
      public int x() {
          return x;
      }
  
      public int y() {
          return y;
      }
  
      @Override
      public boolean equals(Object that) {
          if (!(that instanceof Point)) {
              return false;
          }
  
          var other = (Point) that;
          return x() == other.x() &amp;&amp; y() == other.y();
      }
  
      @Override
      public int hashCode() {
          return x() ^ y();
      }
  
      @Override
      public String toString() {
          return &quot;Point[x=&quot; + x + &quot;, y=&quot; + y + &quot;]&quot;;
      }
  }
  </code></pre>
  <p>Can be written in Java 14 as this:</p>
  <pre class="lang-java prettyprint-override"><code>record Point(int x, int y) { }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T08:36:40.820Z
Answers.Text: I know programming, C in depth, I know the basic of Java (I was taught Java back when I was in std 8 of school till std, 12 of my school) but I want to know it in depth...
Answers.UserDisplayName: Abhishek Ghosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T10:04:30.210Z
Answers.Text: @AbhishekGhosh: In that case, learning an outdated version of the language is not going to help you much. It would be like learning C++ without templates, or K&R C.
Answers.UserDisplayName: Jörg W Mittag
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T08:28:27.163Z
Answers.LastActivityDate: 2020-07-06T10:01:16.667Z
Answers.LastEditDate: 2020-07-06T10:01:16.667Z
Answers.UserDisplayName: Jörg W Mittag
Answers.Body: <p>I would recommend you to rely more on online tutorials. They are updated as fast as the language itself.</p>
  <p>Buy one good latest book. That will help you set the foundation (not that you cannot set foundation from online tutorials.)</p>
  <p>I left programming in Java more than 7 years ago but I have still managed to stay up to date on it through OTLs like Pluralsight, LinkedIn Learning (formerly Lynda.com) and O’Reilly. And I know I am not far behind because I interview with companies in Java while coding in C++ at work.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T16:22:44.900Z
Answers.LastActivityDate: 2020-07-06T16:22:44.900Z
Answers.UserDisplayName: displayName
Body: <p>Java is updating on a regular basis and it being so the corresponding text books to study Java also changes. Now I do not know why the edition <em>&quot;Java 2: The Complete Reference&quot;</em> by <em>Herbert Schildt</em> is so famous, in the sense that I find most educators having a copy of this particular edition and there are abundant used copies of the same available at cheap rates.</p>
  <p><span class="math-container">$\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad$</span><a href="https://i.sstatic.net/kITtF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kITtF.png" alt="Java 2: The Complete Reference" /></a></p>
  <p>No doubt it is based on an older version of Java, but what is the special in this particular edition.</p>
  <p>I am quite confused as to which edition to follow, as in many cases of other texts I have seen that older editions are at times better and clearer in the meaning and newer editions tend to go less lucid at times.</p>
  <p>With the advancement of Java in this rapid rate, which edition to follow (edition 11 is the latest I hope) and how to be updated of the advancements (if I am suggested to follow the latest edition, it is going to get old within a couple of years).</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-05T19:24:31.490Z
Comments.Text: How experienced are you with Java? Are you a teacher or a student?
Comments.UserDisplayName: Buffy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-05T19:39:39.893Z
Comments.Text: I am a student from CS background. I know the basics of Java (to give an idea of what I know, I know that much such that I can read a data structure book based on Java, but not the deeper concepts ...)
Comments.UserDisplayName: Abhishek Ghosh
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-06T09:45:18.967Z
Comments.Text: As well as being 16 years out of date (as mentioned in an answer), Schildt's books have a reputation for being full of errors. One memorable review said that he had "learned something [when creating a new edition of a book], not enough to receive a positive recommendation but at least enough to remove the "positively harmful" description [of the previous edition]". Less polite reviewers have simply omitted the letters c, l and d from his name. Another review suggested renaming one of his books as "C: the complete nonsense (4th edition)". You have been warned!
Comments.UserDisplayName: alephzero
Tags: <self-learning><java><textbook>
Title: Java: The Complete Reference, which edition to follow
ThreadText: # Java: The Complete Reference, which edition to follow
  
  (Asked by: username_0 on 2020-07-05)
  
  Java is updating on a regular basis and it being so the corresponding text books to study Java also changes. Now I do not know why the edition *"Java 2: The Complete Reference"* by *Herbert Schildt* is so famous, in the sense that I find most educators having a copy of this particular edition and there are abundant used copies of the same available at cheap rates.
  
  $\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad$[![Java 2: The Complete Reference](https://i.sstatic.net/kITtF.png)](https://i.sstatic.net/kITtF.png)
  
  No doubt it is based on an older version of Java, but what is the special in this particular edition.
  
  I am quite confused as to which edition to follow, as in many cases of other texts I have seen that older editions are at times better and clearer in the meaning and newer editions tend to go less lucid at times.
  
  With the advancement of Java in this rapid rate, which edition to follow (edition 11 is the latest I hope) and how to be updated of the advancements (if I am suggested to follow the latest edition, it is going to get old within a couple of years).
  
  **Tags:** self-learning, java, textbook
  
  > **Comments:**
  > **username_1**: How experienced are you with Java? Are you a teacher or a student?  
  > **username_0**: I am a student from CS background. I know the basics of Java (to give an idea of what I know, I know that much such that I can read a data structure book based on Java, but not the deeper concepts ...)  
  > **username_2**: As well as being 16 years out of date (as mentioned in an answer), Schildt's books have a reputation for being full of errors. One memorable review said that he had "learned something [when creating a new edition of a book], not enough to receive a positive recommendation but at least enough to remove the "positively harmful" description [of the previous edition]". Less polite reviewers have simply omitted the letters c, l and d from his name. Another review suggested renaming one of his books as "C: the complete nonsense (4th edition)". You have been warned!  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_7 on 2020-07-06. Score: 8
  
  The fundamental question is, whether your goal is to learn *programming* (in which case the language doesn't matter at all … theoretically at least) or to learn Java.
  
  If you want to learn programming, the programming language and the version doesn't really matter. It only matters insofar as to understand the examples, and to understand the concepts behind the code, you need to understand the programming language. So, the code and the programming language should be as simple as possible … e.g. a language like Scheme or Smalltalk, or you already need to know the language.
  
  If you want to learn Java, then you should use a recent book, because there has been a lot of stuff introduced that not only makes stuff easier to read and write, but that fundamentally changes the way Java programs are written.
  
  Sun dropped the "2" from "Java 2" in 2004. That should give you an indication as to how old this book is. It covers Java 2 1.4, which was released in 2002.
  
  You don't have to chase every version, every release, every edition, every new feature (especially with the new 6-month release cycle), but since 2002, there have been multiple new features in the Java language that *fundamentally change* how Java code is written:
  
  * Java 5 (2004):
    + **Generics**
    + Annotations
    + Autoboxing/Autounboxing
    + `enum`s
    + Varargs
    + The enhanced `for` loop
    + [LIB] JSR166 Concurrency APIs
  * Java 7 (2011)
    + [LIB] Extended JSR166 Concurrency APIs
    + [LIB] NIO.2
  * Java 8 (2014)
    + **Lambdas**
    + `default` methods on `interface`s
    + [LIB] **The `Stream` API**
  * Java 9 (2017)
    + **`module`s**
    + [LIB] Reactive Streams
  * Java 10 (2018)
    + Local variable type inference
  * Java 14 (2020)
    + `switch` expressions
  
  [I **bolded** the ones I deem to be particularly disruptive. I marked some features as [LIB] which are *library additions to the Java platform* and not *language features*, but are nonetheless important. E.g. NIO.2 offers a whole new, much higher-level, much improved way of interacting with files. And `Stream`s essentially mean that you will never have to iterate over a collection ever again.]
  
  *Value Types* and *`sealed` Types* will bring another major shift in the near future (possibly as early as Java 15 (October 2020)). In particular, `sealed` Types will allow modeling *Algebraic Sum Types* in Java, which opens up a fundamentally different way of structuring programs.
  
  Oracle has recently started to include so-called *Previews* as well, these are features that are shipped as part of an official release, so they reach a wide audience, but that are not guaranteed to be supported in future releases in that form. They may be changed or dropped completely. One of those features is `record`s that currently ship as a preview in Java 14. While they aren't as disruptive as some of the others (Generics, lambdas, Value Types, `sealed`) as they are just syntactic sugar, they allow to drastically reduce the amount of code for simple data classes, and thus make it easier to see what is going on.
  
  For example, this:
  
  ```java
  final class Point {
      private final int x;
      private final int y;
  
      Point(int x, int y) {
          this.x = x;
          this.y = y;
      }
  
      public int x() {
          return x;
      }
  
      public int y() {
          return y;
      }
  
      @Override
      public boolean equals(Object that) {
          if (!(that instanceof Point)) {
              return false;
          }
  
          var other = (Point) that;
          return x() == other.x() && y() == other.y();
      }
  
      @Override
      public int hashCode() {
          return x() ^ y();
      }
  
      @Override
      public String toString() {
          return "Point[x=" + x + ", y=" + y + "]";
      }
  }
  
  ```
  
  Can be written in Java 14 as this:
  
  ```java
  record Point(int x, int y) { }
  
  ```
  
  > **Comments:**
  > **username_0**: I know programming, C in depth, I know the basic of Java (I was taught Java back when I was in std 8 of school till std, 12 of my school) but I want to know it in depth...  
  > **username_7**: @username_0: In that case, learning an outdated version of the language is not going to help you much. It would be like learning C++ without templates, or K&R C.  
  
  ---
  
  ### Answer by username_3 on 2020-07-06. Score: 5
  
  I'll try to give a few actual textbook recommendations.
  
  If the goal is to learn Java for regular programming, I would avoid like the plague any Java book that doesn't at least go through Java 5, at which point it practically became a different language. I have always found David Liang to be quite a clear writer, and [his most recent text](https://rads.stackoverflow.com/amzn/click/com/935306578X) (finally) introduces Java 5 features such as generics.
  
  If you're looking for a book that shows you the deeper beauty of object oriented programming, [Joseph Bergin's got your back](https://rads.stackoverflow.com/amzn/click/com/1940113059). This isn't a book about Java features, but really more about the *why* of things. Please note that after reading it, you will constantly run into people saying very silly things about OO online. Many people really, really seem to think that they understand it because they have learned some of its mechanics, but they truly don't understand the core idea at all.
  
  In terms of more recent language features, I'm not familiar with this [book by Joshua Bloch](https://rads.stackoverflow.com/amzn/click/com/0134685997), but it is well reviewed, and covers far more recent developments than the Liang book.
  
  > **Comments:**
  > **username_0**: Thanks for the help  
  > **username_4**: Bloch's book is great.  
  
  ---
  
  ### Answer by username_1 on 2020-07-05. Score: 5
  
  For a student, any recent edition will be fine. Don't overthink it. The first task is to become thoroughly familiar with the mental model required of a Java programmer. Or even, for the very experienced, the mental model of a programmer in general.
  
  Most, but not all of the recent changes in Java are in the libraries, but even the more fundamental additions can wait until you can program effectively in *any consistent subset* of the language. The intimate details of most recent additions are much less important than gaining a facility with the ideas of abstraction, composition, inheritance, encapsulation, and such.
  
  And yes, the language will either continue to change or it will become obsolete. Don't worry about that until you can't solve some programming problem effectively with what you already know.
  
  And a good textbook is probably more valuable to you at this point than a reference in any case. Reference material tends to present features in isolation, which is essentially worthless. The features need to work together to be effective. Textbooks will tell you that better than a reference guide.
  
  > **Comments:**
  > **username_0**: Thank you for the help. So please can you recommend me the textbook (with the edition) which you feel is the best.  
  > **username_1**: Hmmm. The ones I wrote, of course. But it would be impossible for me to make a recommendation here. But if a book suggests that Circle is a subclass of Point, it is the wrong book and it will only lead you astray.  
  > **username_5**: Depends how you're defining "recent", but lambdas, default methods, modules, type inference, switch expressions, text blocks, pattern matching, and records are all significant language additions.  
  > **username_6**: Any recent edition may be fine, but the edition that the OP shows is *FAR* from recent. It predates the addition of Generics which is IMO one of the most significant changes in all of Java's history.  
  
  ---
  
  ### Answer by username_8 on 2020-07-06. Score: 2
  
  I would recommend you to rely more on online tutorials. They are updated as fast as the language itself.
  
  Buy one good latest book. That will help you set the foundation (not that you cannot set foundation from online tutorials.)
  
  I left programming in Java more than 7 years ago but I have still managed to stay up to date on it through OTLs like Pluralsight, LinkedIn Learning (formerly Lynda.com) and O’Reilly. And I know I am not far behind because I interview with companies in Java while coding in C++ at work.
  
  
  ---
  
  