jatin rai

Greenhorn
+ Follow
since Dec 27, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by jatin rai

You can use public Double valueOf()


23 years ago

Thanx a lot jim for ya advice & answers. Hey I've 1 more question which I've long tested. When I try to declare float a= 2.0 compiler dosen't allow me 2 do that but I can declare it as a double. What's the reason behind this?


23 years ago


try working out this! take look at the bold secyion.
$> cat Hello.html
< !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
applet codebase="[your current directory!]" code="HelloWorld.class" width=300 height=50
Hope this helps your cause & if not please tell me & I'll try something else.
all the best
bye


[This message has been edited by jatin rai (edited July 08, 2001).]
[This message has been edited by jatin rai (edited July 08, 2001).]
23 years ago
hi!
your problem seems a lil bit complicated as I couldn't figure out why reducing the thread priority messed up the whole code. But where I can help is the other part i.e. random wait. when u synchronised somerun then first tr3 started & initiated tr1. then tr4 started & initiated tr2 (lock was released by tr3 then only tr4 started.). now the lock is just gone, nothing is synchronised. So u can't expect lock behaviour n e more.
As far as somebody above replied that try synchronising run but that also won't helpful b'cos u r overriding run. U should strictly adhere to the signatures of the original run & if u synchronise it most probably your start() won't call run as it usually does although u won't receive n e compile time errors. But i guess u should go & give it a try.
all the best
[This message has been edited by jatin rai (edited July 08, 2001).]
thanx. but u left out 1 point & that is can we make an array with long variable giving it's size!!!
23 years ago

Originally posted by Jim Yingst:
For your first question - for a = 20 the correct result is 3890875847. This is too big to fit into an int value (maximum value 2147483647) so roundoff error occurrs. The value is converted to an int value by truncating all but the lowest 32 bits - which, as it happens, leaves a negative value in this case. Basically, if you overflow the value of an int (or other integral type), the value is meaningless. The simple workaround in this case is to declare arg as long rather than int. If that eventaully overflows as well, switch to BigInteger (which will require other code changes as well).
As for your second question - let's see, for a = 19 the value of arg is 1743392200. Are you saying that you tried to create three arrays of size 1743392200, and you're not sure why you would run out of memory? Perhaps I have misunderstood your question.



thanx for your answer. Just lemme know that how u reached that final value for int? I mean how can I calculate that? the other thing is that is it possible to create an array with long as it's size??? What is BigInteger? I don't think that it's a primitive datatypein java! Is it a class implementation or what? Please elaborate!
23 years ago
well there's something new. I had read on javasoft.com long time back that told u 2 make manifest file out of your jar file which'll allow u 2 doubleclick program icon & run it without needing 2 go 2 dos prompt. But I feel that u'd still need jre!!!
23 years ago
i had the following piece of code:
for(int l=a;l>=0;l--){
arg+= (int)Math.pow(3,l);
System.out.println("arg= "+arg+" l= "+l);
}
it worked fine for a=19, but after I made a=20 it gave negative results.
What's the reason & remedy to it?
1 more thing & that is that I tried 2 create 3 arrays of the size of arg but then it says out of memory error.
Well I'm using win 98 with 128 MB of RAM & I wasn't runing much of my programs while running this. So where has all the memory been consumed??
Please reply soon.
23 years ago
well for memory leakage u must have got the answer. as far as stacks are concerned I'll tell u. Stacks are data structures i.e. they have ability 2 store data. They r typical in the sense that u can only add data to the top of the pile. Say it's like a pile of bricks in which u can only remove or add bricks from the top. u can't operate on it in somewhere middle or bottom but u r allowed operations only on the top of the stack. this is also termed as tos(stands for top of the stack). 2 terms typical to it r push & pop. push is adding element 2 the top of the list & pop is removing element from the top of the stack. in java we've the implementation of stack as a class & is available in collections framework.
hope I made my point clear. all the best
23 years ago
dear asheesh
See basically your o/p is in the integer form. While the Sop (System.out.println) takes a String class object as it's parameter or in simpler words u must pass on a string value to Sop method. Now when the answer to the argument passed is evaluated it comes out to be 10. now the JVM finds that the answer is in the integer format & not the compiler format. to this the interpreter calls the toString() method or the valueOf() method. this converts 10 to "10" & gives the o/p. but dear acc to me it depends on the valueOf() method. on one ocassion it might have called the valueOf(int) & on the other ocassion iot might have called valueOf(double) & given th o/p as 10.0
23 years ago
why, how & where to use the word transient? please explain with an example. u can mail the results at sweet_n_cool_guy_18@yahoo.com
23 years ago