JavaLanguage Section Index | Page 2
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? Why should I use Class.forName("");
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 s...more
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.
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.
Please explain the differences between instanceof and isInstance(Object obj).
Please explain the differences between instanceof and isInstance(Object obj).
What is the reserved keyword transient used for?
What is the reserved keyword transient used for?
How can I multiply two double numbers without loss of precision?
How can I multiply two double numbers without loss of precision?
How can I represent monetary values in Java? Should I use double or float?
How can I represent monetary values in Java? Should I use double or float?
How do you just the @Deprecated annotation?
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 something is deprecated:
public class Dep ...more
How do you use the @Override annotation?
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 tells you. This allows you to catch typos li...more
What are the differences between instance methods and class methods?
What are the differences between instance methods and class methods?
How do you use the ternary operator?
How do you use the ternary operator?
java.lang.OutOfMemoryError: Java heap space What does this error mean and how can I correct it?
It means that the JVM has run out of all the memory that has been allocated to it. You can change the amount of memory allocated for use by your JVM using the -Xms and -Xmx command line parameter...more
I have an interface that is implemented by 100 classes, if I add a method to the interface will my classes compile? How can I fix any errors?
I have an interface that is implemented by 100 classes, if I add a method to the interface will my classes compile? How can I fix any errors?
Java doesn't allow operator overloading yet + is overloaded for class String. Is it possible to overload operators? Why doesn't Java allow operator overloading?
It is true that Java does not allow operator overloading. It is also true that an exception was made for String, although this is out of the control of developers as it is a built in feature of J...more
What is the main use of the ResourceBundle class? Can it be used instead of the Properties class? If so what are the advantages?
ResourceBundle is a property file handler with locales support, it allows you to support multiple languages in your application. There's a full explaination on what ResourceBundle is and how it h...more
Can Java handle nested switch statements?
Nested switch statements are allowed. Just make sure you remember to have all the break statements in the correct places. E.g:
int i;
int j;
switch(i){
case 0: System.out....more