rashu gulati

Greenhorn
+ Follow
since Nov 06, 2003
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 rashu gulati

Can someone pls. explain this to me?
class A {
private int[] val;
private int hash;
public int hashCode() {
int h = hash;
if (h == 0) {
int len = val.length;
for (int i = 0; i < len; i++) {
h = 31*h + val[i];
}
hash = h;
}
return h;
}
// The equals method has been omitted for clarity.
A (int[] val) {this.val = (int[])val.clone();}
public static void main (String[] args) {
A a = new A(new int[]{1,2,3});
System.out.print(a.hashCode());
}}
What is the result?
Thanks ! I am a fool i thought that the parameters must of same type .
Thanks though
Which are valid?
(1) Math.max(1,4)
(2) Math.max(2.3,5)
(3) Math.max(1,32,2)
(4) Math.max(-1.8,-4.2f)
my answer is (1) only.but the answer is 1,2,3
Can someone explain why?
Which is true abt the code below::
public class joining{
static Thread createThread(final int i,final thread t1)
{
Thread t2=new Thread(){
public void run(){
System.out.println(i+1);
try{
t1.join();
}catch(Interrupted Exception e){
}
System.out.println(i+2);
}
};
System.out.println(i+3);
t2.start();
System.out.println(i+4);
return t2;
}
public static void main(String[] args)
{
createThread(10,createthread(20,Thread.currentThread()));
}
}
Can anyone explain the sequence to me?
Thanks
Rashu Gulati
Suspended is depracated so dont think of that option.Then finished meians it cant start again.Then comes the 2 in runnable states .The priority is from 1-10 in increasing order,so the answer is obviously 3.
Thanks
Rashu
Vicken
Cant wait() and sleep()take the thread to runnable state.I mean they take it in waiting state but can they be the answer?
Thanks
Rashu
Hello
I am preparing for SCJP for last 1 month.I have seen 2-3 books but still have a confusion.When there are multiple answers for a question in the exam like 3 of 5 or so ,is it metioned in the question that choose 3 correct answers?
Thanks
Rashu Gulati
I think that the left operand can be promoted to long or int.
Also i know something abt. <<,<<< & >> operators but cant really figure out a way to solve when some negative numbers come into picture.
Thanks
Hi
I need to know the answer of : -42>>-4 and also a easy way to find it out.
Please help me
Also Can shift operators be applied to float,double.
Thanks
Rashu Gulati
Hello All
I am new to this place.Planning to give certification sometime soon,so while going through some site ,read a lot abt. the discussion forums here.Hope to get good response from all.Lookling forward to learn a lot.
Thanks
Hello
I joined the forum today only .Hope my answer helps you out.All you need to do is to have a web.xml file in /mainwebapp/WEB-INF which will look something like this.
<servlet>
<servlet-name>
AssignmentCookie
</servlet-name>
<servlet-class>
AssignmentCookie
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
AssignmentCookie
</servlet-name>
<url-pattern>
AssignmentCookie
</url-pattern>
</servlet-mapping>
</web-app>
All u have to do is to replace the assignmentCookie by your file name.
Hope it helps you.
20 years ago