Mike Petrogeorge

Greenhorn
+ Follow
since Feb 13, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Petrogeorge

Normally, you don't worry about it. However, for the SCJP, or if your doing any generic programming, you need to worry about it.

If you change the declaration to Vector<Integer> v = new Vector<Integer>() your compiler should shut up. I have not looked, but hopefully there is another thread that talks about generics and there you can study the details of that declaration statement.
Well, whats weird is that int and the double being the default literals for numbers.

for example:

int a = 5;
int b = a + 10;

The five and ten are literals and are int by default which is 32 bits.

float a = 10.5 // will not compile because 10.5 is a double. To compile you stick an f on the end of 10.5

Thats the weird part. The non decimal literal is int or 32 bits. The decimal literal is a double or 64 bits. Why not keep all literals 32 bit? Someone smarter than me will have to answer that question.
Well, yea, compile exceptions are caught by the compiler, and runtime exceptions are caught at runtime. But for the test, you gotta know that compile time exceptions are known as checked-exceptions (extend object Exception) and run time exceptions extend RuntimeException (who also extends the Exception). Check the java 5 documentation. You will find that Throwable is the daddy object, Exception extends Throwable and is the main object. Then you have the RuntimeException. Exceptions like NullPointerException and ArithmeticException extend the RuntimeException. Hence runtime exceptions (as far as the test is concerned).