This week's book giveaway is in the Reactive Progamming forum. We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line! See this thread for details.
A class is the definition of some object data type.
Class is the basic building block of an object oriented system.It is a an entity which acts as a data type and also shows behaviour.A class can have attributes and functions of its own.Thus it can act on messages and also maintain its state.
What's the difference between a static field and an instance field?
Instance fields belong to objects (which are instances of a class) with each object having its own copy.
Static fields belong to a class, and we all know there's only one of each class, so there's only one copy of each static field.
Static variables are initialized at the class load time, instance variables are initialized before a constructor is executed.
Why is 1.0 - 2.0/3.0 != 1.0/3.0? (and other arithmetic inaccuracies)
Arithmetic as done by Java has limits to its accuracy. Some of these have to do with the fact that computer arithmetic is done with base 2, not base 10. Another reason is that 1/3 does not have a finite representation in either base 2 or base 10. You can find a more detailed description here . All the details can be found in the article What Every Computer Scientist Should Know About Floating-Point Arithmetic
Java2s also covers advanced Java APIs and 3rd-party APIs. Even more examples are at Kode Java.
What are the differences between the various JDK versions?
The documentation of each JDK release contains a page called "New Features and Enhancements" (or similar), which lists the changes from the previous release. You can find links to the documentation of the various releases here. The javadoc page for a class also mentions the JDK version in which it was introduced.
I'm having trouble understanding how algorithm XYZ works.