Prosenjit Banerjee

Greenhorn
+ Follow
since May 04, 2001
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 Prosenjit Banerjee

Thanks very much Cindy. Thanks again for the reference.
Hi everybody,
Comments are expected about my previous post. Please, because I want to match my thinkings with others'.
I LOVE JAVARANCH.COM
Hi Srinivasan so many thanks to you.
But THE MYSTRY STILL PERSISTS
Please try to understand what I want to say.
1. It is good that

gives error.
But why

has no error?
2. Why it is a different case if I omit braces of any kind of loops or if constructs. If you say that it is the rule then I would ask for the specifications of such a rule and the reason behind such a rule.
3. What about the final variable? Why Java2 does not complain if I write

while Java claims that it is so friendly? Is it a bug?
You only stated the behavours you experienced but did not solve the problem. I tried to state the possible solutions but don't know whether I am correct. I know the behavour but don't know the reason behind it.
I am confused . Please help me.
I LOVE JAVARANCH.COM
Thank you very much Cindy Glass and the thread starter rajashree ghatak. And, here you look what I did. It's a new experience.
Following is a java program that consists only some unicode characters (although there are some new lines for the sake of clarity only).
This code compiles and runs without any error.


This actually looks as the following :

I LOVE JAVARANCH.COM
Dear all,
This thread is really interesting. Thanks Mr. Shah Chunky. Everybody tried to solve the problem, but I think none of them had a real satisfactory answer.
Even I can't solve the problems. But I can guess and want share it with others and check whether I am right.
The first problem is the compiler shouts when I write the following :
while(...)
int i = ...;
The same problem arises when I replace while with if. The compiler smiles if I include the statement with braces like the following :
while(...)
{
int i = ...;
}
The question is why or whether the compiler should behave like this. According to me the compiler behaves like this, because it does not want to confuse the developers. But where is the question of confusion? Look at the following :
int i = 3 ;
if(i == 3)
int j = 4 ;
We know that here j j can't be accessed outside the if statement. But the code seems to be that j is defined in the outer scope and it gets defined only if the value of i is equal to 3. There is a confusion because later we may want to refer j in the outer scope and it will fail failing us to quickly debug that where the problem is. (You may shout "Oh boy, why are not you getting compiled? Be steady and look there that i equals 3 and thus j is defined and has got a value of 4" .)
Actually such a loop or if construct that contains merely a statement which does nothing but defines a variable has NO PRACTICAL USAGE (of course, according to my limited knowledge). If we still want to write such a statement (just for fun, isn't so!) we have to write it more clearly and more specifically so that the statement can tell "Hey, now you see I am in the inner room, you can't get me outside this room".
If it is the real fact, I would thank JAVA.
But i don't know what about the second problem. I am using Java 2 and get the problem. Since many of the responders faced no problem with Java 3, I can conclude that the complier creators have realised that "there is no harm with determining the value of the final variable (because it gurantees to be never changed) and then to decide whether to allow the developer to compile the code.
But I (we) still wait for some more better and confident answer. Hey, William Brogden, Cindy Glass, Paul Anil, Junilu Lacar and all, can you here me (us)? Where are you? Please help me (us).
Prosenjit Banerjee.
I LOVE JAVARANCH.COM
Hi all,
Please explain me the following code :


Here, unlike C/C++, I can't define a variable having the same name as that of the outer block from inside of the inner block in the same method. This nature seems to be like that "you can have only one variable of the same name in the same METHOD". I have mentioned the word "METHOD" and not the word "BLOCK" because the compiler told me that "variable varname is already defined in this method". But in spite of the fact that the variable 'j' has already been defined in a method (although in the inner block), I can define it again in the same method (although in the outer block)!
Please tell me what is the actual rule behind it.
Thanks in advance.
I love javaranch.com
Dear Sir,

Sorry sir, but I really could not understand how the above code works as I don't understand how the following code works too :

where the following does NOT work :

But as far as I remember I found somewhere in this forum that if we write var1 += var2 where var1 is a variable of type Type and var2 is a variable or a literal of any type then the compiler treated it as follows :
var1 = var1 + (Type)var2 ;
Am I correct, sir, please please explain me.
Thank you very much in advance.
I LOVE JAVARANCH.COM
Hi,

The following error shows in line 2 :
Incompatible type for declaration. Explicit cast needed to convert int to byte.
This error goes off if I write .
My question is why is trying to widen to type int ?
Thanks in advance.
Wow, finally I got the desired answer. Thank you so much Mr. Paul Anil and Mr. Junilu Lacar for the references offered.
I tried the following two codes in my MSDOS terminal under Win98.
Code #1 :
---------

Code #2 :
---------

I prefer the second code. Because it seems much faster than the first. But to make it working the ANSI device driver must be installed. I installed it by inserting the following line in my config.sys and then restarting the computer :
.
Thanks very much.
I LOVE JAVARANCH.COM.
Javaranch is the BEST. I never seen before such a good site. THANKS JAVARANCH.COM.
Anyone please let me understand the process of converting a byte array to BigInteger BigInteger(byte arr[]) and converting a BigInteger to a byte array BigInteger.toByteArray().
Thanks in advance.
21 years ago
Javaranch is the BEST. I never seen before such a good site. THANKS JAVARANCH.COM.
Anyone please let me understand the process of converting a byte array to BigInteger BigInteger(byte arr[]) and converting a BigInteger to a byte array BigInteger.toByteArray().
Thanks in advance.
Thank you very much for replying me. I think I got my answer. I have to use JNI. But since I do not know how to use it, I have wait some days more to learn it and then apply.
But I think Mr. William Brogden has an OS specific anwer. If really he has please let me know. I have already mentioned what kind of system I am using.
Thank you very much again.
Thanks to all who tried to answer me. But still I have no specific answer. Please help me.
As asked by Mr. William Brogden I am using Windows 98 and trying to run the program in the DOS shell.
Waiting for desired reply...
Someone please suggest me, whether the above (setting the character mode cursor at a particular position)is possible??
Please tell me. It is URGENT
Thanks Mr. Mikael Jonasson, but clearing the screen means not only clearing but also setting the cursor to the upper left position of the screen. What about that? Please suggest.
Thank you.