What should every Java greenhorn know?
(For more advanced topics, check out the Java-FAQ.)
How do I run my very first Java program?
Got no money for books so how can I learn Java?
I want to buy a couple of books about Java. What do you recommend?
- What does a Java program look like?
Where is the Java API?
What non-Windows Support is there for Java?
What's a JAR file, and how do I make it executable?
How do I make an .exe of my Java program?
- Browse through JavaRanch's book reviews. If you see a book that satisfies your needs a simple click will take you straight to where you can order it.
Classpath, what is it and how do I set it?
What is a Singleton?
What is threading?
What is an object?
- Maybe using executable JarFiles would be more appropriate. See the MacOsxFaq for hints on how to build a double-clickable OS X application.
- JWrapper creates native Windows, Linux and OSX apps.
What is the difference between an object and an instance?
What is a class?
- It's a thing with state and behavior, of course.
- It's an instance of a class
- An object is a User-defined Data Type (UDT).
What's the difference between a static field and an instance field?
- 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.
Can you override a static method?
Is Java call-by-reference or call-by-value?
What is a JVM? JRE? JDK? J2SDK?
- 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 (added by - Kunal Jaggi).
How do I clear the console screen?
Why is 1.0 - 2.0/3.0 != 1.0/3.0? (and other arithmetic inaccuracies)
- A JVM (Java Virtual Machine) is an imaginary (theoretical) machine that executes Java bytecodes.
- A JRE (Java Runtime Environment) is a software implementation of a JVM and all the standard Java libraries, and other bits and pieces that are needed to make the thing actually work.
- A JDK (Java Developer's Kit) or J2SDK (Java 2 Software Developer's Kit) are two different names for the same thing: a JRE plus tools like the Java compiler, debugger, and other things needed for basic Java development.
- The diagram on this page visualizes it nicely: JDK and JRE are brackets on the left, while the JVM is the blue layer at the bottom.
What are the differences between an interface and an abstract class?
Where can I find example code for the XYZ class?
- 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
- Java implements exact arithmetic with the JavaDoc:java.math.BigInteger and JavaDoc:java.math.BigDecimal classes. As an aside, calculations involving amounts of money should never be done with floats or doubles, but always with BigDecimal.
- Another option is to use decimal arithmetic, which avoids the problems caused by binary numbers. More information about that can be found here
What are the differences between the various JDK versions?
- The Example Depot has lots of commented examples. Java2s also covers advanced and 3rd-party APIs. And some more examples from Kode Java website.
I'm having trouble understanding how algorithm XYZ works.
How do I work with dates, in particular, convert between dates and strings?
- 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.
What is a compile-time constant?
Can I test code without installing anything?
How do I override the equals and hashCode methods?
- The JavaDatesFaq has example code for the most common tasks, as well as links to some further material.