jason stark

Greenhorn
+ Follow
since Dec 01, 2002
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 jason stark

I found this compiled
while(false) {
//some code
}
I had it running infinatly when I tested it
Jason
thanks Paul that really makes sense of it
I don’t understand why the code below compiles: –

But when I change the catch statement it fails

If I change the catch statement to (Exception e) it also compiles and runs
Is there any rule here that explains this?
Thanks Jason

[ Jess added UBB [code] tags to preserve whitespace, check 'em out! ]
[ January 25, 2003: Message edited by: Jessica Sant ]
I came across this question and answer and I don't understand the answer.
Here is a method which creates a number of String objects in the course of printing a count down sequence. When the program reaches line 8, how many of the String objects created in line 5 are eligible for garbage collection? Assume that the System.out object is not keeping a reference.
1. public void countDown()
2. {
3. for( int i = 10 ; i >= 0 ; i-- )
4.{
5.String tmp = Integer.toString( i );
6.System.out.println( tmp );
7. }
8. System.out.println("BOOM!");
9.}
A)none
B)1
C)10
D)11
C is correct. Answer A and B are wrong and C is correct because only the last String object of the 11 created still has a reference. Answer D is wrong because even though the tmp variable is out of scope in line 8, the local variable still has a reference.
I don't understand why the local variable still has a reference at line 8. I don't understand why its not 11 or 1
Any help in understanding this would be appreciated Thanks Jason
the brackets {} can only be used to initialize the array as part of the array declaration
try this int[] i1= {1,2,3};
I'm wondering if its assigning the same way as
byte b = 100;
as the value of i is final and the compiler is relaxing its usual assignment rules.
I've tried with a Window quickly.
I came across this question in a test exam and the answer was yes there is but I cannot find out to what.

Originally posted by david eberhardt:
<hr></blockquote>
Jose:
Wow - if this had been a test question, I would have got it wrong!
I think what threw me off is that I am not used to seeing the same variables that are declared in the superclass, redeclared in the subclass as is in the case above.
So I am not sure what behaviour this would cause.
Anyways, since I plan on inheriting things in the subclass, I rewrote the code to the following:

Your code and information was a real eye opener though![/QB]


Hi I tried this bit of code and removed the this bit removed and it made no diffence to what was printed.
Thanks to everyone who replied Jason
I'm preparing for the Sun Certified java exam. I've tried refencing a static variable from within a method using "this" and it worked. I didn't expect it to as the variables not attached to an object. Also I've managed to compile transient variables with the prefixed by the word static which I read was not possible.
Also some times I've seen this as legal:-
public static int main(String[] args)
will this be legal for the exam
thanks for any help Jason