Anders Hermansen

Greenhorn
+ Follow
since Nov 15, 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 Anders Hermansen

But every time a make a new instance of class A will there be a reference to String s? An d if yes - will the reference exist on the stack or heap?
16 years ago
Thanks for the answer.

My concern is if a make 10 or 1000 instances af class A, how many references and objects will there be of the static variables ?
16 years ago
Hi

If a user create ten instances of an object with a static final long, and a static final String and a private long, how will the different instances fill up in memory on stack, heap and String pool.

Example:

class A {
static final long firstlong = 99;
static final String s = "ab";
private long anotherlong = 12;

/* more code */

}
16 years ago
I just asked a question almost about the same object.

There i asked if it is right to think of a JVM thrown exception as a RunTimeException and a programatically thrown exception as a checked exception.

If it is, then the correct answer is B and D.

And not C even though K & B in their book on SCJP states that NumberFormatException is typically thrown programatically. The JAVA API states that NumberFormatException is a RuntimeException.
Hi,

on page 370 in K & B book on SCJP they write that NumberFormatException is a exception typically thrown programmatically.

But is it not a RuntimeException? And therefore thrown by the JVM?

(Just for case of clearness: in the table on same page is it right to say that exceptions thrown by JVM are RunTimeExceptions and programatically exceptions are checked exceptions?)
I would suggest that since Integer.MAX_VALUE is a constant (= will not change), the bit pattern stays the same and = = looks at the bit pattern.

Hence ex. 2 returns true.