Kamil Dada

Ranch Hand
+ Follow
since Aug 07, 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 Kamil Dada

Hello,
Jane, thanks for your help.
I really appreciate it.
-Kamil

Originally posted by Ashik uzzaman:
Kamil,
I scored 70% and 65% in JQ+ test 1 & 2 and now need ur comment. You did not post any message in Programmers Cert Result Forum abt how did u do in the exam....We r waiting for ur reply along with some experience sharing....


Hello,
Unfortunately I failed with 52%
I should have studied more...
As for the questions, they were all really focused on the fundamentles, and didnt ask any difficult coding. Generally, the way they asked was sort of like Marcus Greens mock exams
-Kamil
Hello,
I was wondering if anyone could tell me all of the good/recommened books that one should study as a guide to SCJP2 certification? eg the full name of khalid's book/books and the full name of R&H book and any other good books.
I will then go to my local bookstore and buy the best ones.
Thank You,
Kamil.
Hello,
I have just one more day to go before I give my exam , should I finish reading marcus greens tutorial or should I read some notes? (Eg Janes notes) Or should I give some mock exams?
My exam is at 11 in the morning the next day, so should I do some final revision then also?
Thank You,
Kamil.
For positive numbers the results are fairly predictable. Thus the signed shift of the positive number gives the following results

int x = 14;
int y = 0;
y = x >>2;

System.out.println(y);
Outputs 3, one bit is lost and falls off the right hand side
int x = 14;
int y = 0;
y = x <<2;
System.out.println(y);
Outputs 56

I found this strange since the top one prints 3 but the bottom prints 56?
Shouldnt the top one have been 8 then?
P.S.:Please reply soon since I am giving the exam in one day
Thank You,
Kamil.
Hello,
No I actually meant it doesnt become that since the operator &&= doesnt exist. I was asking why it doesnt exist. I mean isnt there any reason why they dont have it?
Thanks,
Kamil.

Originally posted by Jane Griscti:
Hi Kamil,
Initialization blocks are useful if you need an involved initialization statement for fields. For example, you may have a static field to hold the names of the months. You can declare a <code>static String[] months = new String[11];</code> and then place all the actual initialization code in a static initializer, just to make things a little neater.
Static initialization blocks are run only once, when the class is loaded. Instance initializer blocks are executed once for each new instance.
Hope that helps.


Hello,
Hmm so if i did:

and regarding static initializers since they are only run once when the class is loaded (loaded; meaning what?)
if i did:

Am I right?
Thank You,
Kamil.
Hello,
Hmm thanks! I think ive got it now
Just to confirm:
if we have:

likewise in:

Thanks,
Kamil.
Hello,
Yes, you are quite right,
InputStream is used to read data (eg from files etc) and then use the data it got (from the file) and do things with it; an eg could be: a certain type input stream (you have many, buffered, byte,char, etc) reads the contents of a txt file and then prints it out every second letter from it on the screen
OutputStream is used to write data (eg writing to a file etc)
A good example of both of them used together in the same program would be that you use a inputstream to read the contents of a file called file and then use a outputstream to write those contents to another file called file1, and write every second char of the contents of file to another file called file2
etc etc etc...
Hope that helps
Kamil.

Originally posted by chao-long liao:
Thanks everybody ^_^
But I still have a question,in Java,
there are two ways to pass argument.
1. pass by value
//used by primitive data,it dosen't change the original value
2. pass by reference
//used by reference,it will change the original value
the above statement is correct??
this question is a reference,why using "pass by value"??


Hello,
It is a common mistake which people make, by saying that java has two way to pass a value:
1. pass by reference
2. pass by value
but which is wrong.
Remember this: In java, when you pass a value to some method (or anything else) you ALWAYS pass a copy of the value
eg:
if you pass a variable "abc" to a method "def", then method def will recieve its own copy of a variable (which is why if we change a value in the method which exists in the class aswell, the class-level one does not get changed; thats why we need to use this.variable name if we want to change the class-level variable)
and any changes made to the variable will not affect the original value
if you pass a object to a method, you do not actually pass the object to the method, but a copy of the reference referring to the object, so even if you change anything in the method, the data of the object will get changed (this is why people think you have passed the object)
If the second part of passing a object is unclear
refer to the campfire stories of this site; I think they had a detailed explanation of pass by value
Kamil.


Hello,
I dont think you can initialize variables in a method/constructor argument list since that place is kept for declaring the arguments which will be recieved when it is called. Anyhow, a = b will also not work since you are trying to set the variable a of the method; which does not exist. You would need to do: this.a = b;
Try this:

I hope what I am saying is right, someone please correct me if im wrong.
Thanks,
Kamil.
[This message has been edited by Kamil Dada (edited August 15, 2001).]
heh
Guy might just be right!
any other people got their own views on this?

Kamil.
Hello,
Since we do:

which would result in a containing the value of false
so according to our logic/common sense:

should mean that a becomes false
<PRE>
but it doesnt since &&= doesnt exist
^
Thank You, |
Kamil. |
|<---- Edited to add this
</PRE>
[This message has been edited by Kamil Dada (edited August 15, 2001).]
Hello,
Hmm, strange, Main returns shouldnt be printed since the method never finishes. As far as I know, there should be only one thread.
Try this:

this code shows you that you have only made one thread and it shows that the for loop will never end. The message Main returns should also not get printed. (Check this code to see if it compiles i havent )
Someone please correct me if im wrong, and also please answer my question above (in the code) about sleep and wait
Thank You,
Kamil.
[This message has been edited by Kamil Dada (edited August 14, 2001).]
Hello,
Hmm, interesting...| |= is not there either, so then I guess short circuit operators cannot have these "short-cuts". However, what would you explain |= to be? Since with | a bit gets set if there is a bit set in the first expression, the second one, or even both. Meaning that if a | b; and a = true then it wont bother checking the value of b right?
So why isnt there a | |=, &&=, while there is a |=?
Thank You,
Kamil.