jGuru
Register Email     Password Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search   jGuru Search Help

View:
JavaLanguage FAQ Home Page

FAQ Manager is guru Byron Tymvios.

This FAQ encompasses the Java language proper including syntax and semantics. [FAQ Previously managed by John Mitchell].

What's New

How do I split a space or comma-separated list?
Java:Language:Syntax
John Zukowski PREMIUM, Mar 6, 2008
The split() method of String takes a regular expression. The pattern "[\\s,]+" should to the trick. It says the separator will be one or more white space...
How can the following throw a NullPointerException? Integer i = ...; int j = i;
Java:Language:Exceptions
John Zukowski PREMIUM, Jan 2, 2008
Since Java now does auto boxing and unboxing, if the Integer variable i is null, the assignment to j will throw a NullPointerException since the conversion...
What is a magic number?
Java:Language
John Zukowski PREMIUM, Sep 28, 2007
Magic numbers are literal numeric constants, typically stuck in the middle of code with no obvious reason for existance. Instead of using magic numbers,...

I'm looking for better date-time handling classes. Where can I find it?
Java:Language:Classes
John Zukowski PREMIUM, Jun 3, 2007
You're not alone here. JSR 310 is attempting to remedy this situation (http://www.jcp.org/en/jsr/detail?id=310). In the meantime, you can try out Joda...
Does Java work with Windows Vista?
Java:API:Swing, Java:Language
John Zukowski PREMIUM, Oct 31, 2006
Chet Haase at Sun claims "Java on Vista: Yes, it Works" at http://weblogs.java.net/blog/chet/archive/2006/10/java_on_vista_y.html. There is more said there...
What does Class<String> mean?
Java:API:Collections, Java:Language:Declarations
John Zukowski PREMIUM, Oct 31, 2006
Class<String> is the generics way of writing String.class. It allows you to improve type safety.
What does Class<String> mean?
Java:API:Collections, Java:Language:Declarations
John Zukowski PREMIUM, Oct 31, 2006
Class<String> is the generics way of writing String.class. It allows you to improve type safety.
What is the natural ordering of a Boolean? Does FALSE come first or second?
Java:API:Collections, Java:Language:Classes
John Zukowski PREMIUM, Oct 31, 2006
Boolean.FALSE < Boolean.TRUE
What version of J2SE must I use to deal with the changes US daylight savings time in 2007?
Java:Language
John Zukowski PREMIUM, Oct 31, 2006
Java SE v1.3.1_18 (and later) Java SE v1.4.2_11 (and later) Java SE 5.0 u6 (and later) Java SE 6 SE
My application is using the the classes from some jar file. I have made my application as jar and when I run my jar file I am getting the error "java.lang.NoClassDefFoundError:". These classes are present...
Java:Language
WarnerJan Veldhuis PREMIUM, Oct 11, 2006
Set the Class-Path paramter in your manifest. For details see here: http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html
What's the difference between a transient and non-transient exception?
Java:Language:Exceptions, Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Sep 30, 2006
Subclasses of SQLException have two types, transient and non-transient. Transient exceptions are those that when retried could succeed without changing...
How can I find the dates of all the weekend days in a year?
Java:Language
Byron Tymvios, Sep 29, 2006
import java.util.Date; import java.util.Calendar; import java.util.ArrayList; import java.text.SimpleDateFormat; public class WeekendFinde...
For loading and registering a driver you should use Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"), but I have used JdbcOdbcDriver j=new JdbcOdbcDriver() and I still get a connection. Why is this so?...
Java:API:JDBC, Java:Language:Semantics, Java:API:JDBC:Drivers
Byron Tymvios, Sep 26, 2006
Using Class.forName will create and initialize an instance of the class you pass in as a paramter. So using Class.forName will achieve the same result...
How can I format an int to contain a set amount of characters? If the set amount of characters is 6 and the int == 12345 then it should become 012345.
Java:Language:Classes
Byron Tymvios, Aug 30, 2006
int iValue = 12345; java.text.DecimalFormat df = new java.text.DecimalFormat("00000"); String sResult = df.format(iValue); System.out.println("Format:...
Please explain the differences between instanceof and isInstance(Object obj).
Java:Language:Syntax
Amir Pashazadeh, Aug 29, 2006
First difference: instanceof is a reserved word of Java, but isInstance(Object obj) is a method of java.lang.Class. Other differences: you could...
What is the reserved keyword transient used for?
Java:Language:Declarations
Byron Tymvios, Aug 28, 2006
The transient keyword is used to tell Java that the specified variable should not be persisted when serializing an object. All nonserializable fields...
How can I represent monetary values in Java? Should I use double or float?
Java:Language
Byron Tymvios, Jul 31, 2006
To represent monetary values in Java you should use the BigDecimal class. Using double or float might result in loss of precision as they have rounding...
How can I multiply two double numbers without loss of precision?
Java:Language
Byron Tymvios, Jul 31, 2006
To avoid loss of precision you need to wrap the doubles in a BigDecimal object. Then you can use the multiply(BigDecimal) method of BigDecimal to do...
How do you use the @Override annotation?
Java:Language:Syntax
John Zukowski PREMIUM, Jun 30, 2006
Use this annotation to tell the compiler that the method is supposed to be overriding a method in the superclass. If by chance it doesn't, the compiler...
How do you just the @Deprecated annotation?
Java:Language:Syntax
John Zukowski PREMIUM, Jun 30, 2006
You place the @Deprecated annotation above the method or class you want to flag as out of date. You can still use the @deprecated javadoc tag to say why...
« previous beginning next »


Ask A Question



Related Links

JavaLanguage Forum

Sun's Java Tutorial

What is the Java Platform

JavaWorld Magazine

IBM developerWorks

Java 2 SDK Tools and Utilities

The official Sun JavaDoc 1.1 documentation

The official Sun JavaDoc 1.2 documentation

The official Sun JavaDoc 1.3 documentation

The official Sun JavaDoc J2EE documentation

Wish List
Features
About jGuru
Contact Us