anita narula

Greenhorn
+ Follow
since Nov 28, 2000
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 anita narula

No, it is not right. If the newly created thread is not set a priority in the constructor, then it gets the priority of the thread that created it.
Because all numerical comparison operators e.g. ==,<=, >=,etc, considers no difference only between +0 and -0.
Hope this helps.
What will be the answer for the following:
1) byte b = (byte)255;
2) byte b = (byte)128;
3) double d1=1.0;
double d2=0.0;
byte b=1;
d1=d1/d2;
b = (byte)d1;
System.out.println(b);
The answer for 3) is -1. How?
public class Tes {
void setColor(byte i) { System.out.println("" + i);}
public static void main(String args[]) {
Tes a = new Tes();
byte b = 30;
a.setColor(b);
a.setColor(30);
}
}
Why does it say explicit cast needed to convert int to byte.
But the value 30 is within the range of byte. What am I missing here?
Can anybody please explain.
public class ExceptionTest{
public static void main(String args[]) throws Exception{
try
{
m2();
}
finally { m3();}
}
public static void m2() throws NewException
{
throw new NewException();
}

public static void m3() throws AnotherException
{
throw new AnotherException();
}
}
The answer says it will compile fine and throw AnotherException when
run. But will it not throw both the excptions?
Overloading, Overriding or Late Binding .Which of these are the features of polymorphism?
I have read that overloading is a feature of polymorphism and overriding is a feature of runtime polymorhism?
But different mock exams give different answers. Can anybody give me the correct answer.
Thanks in advance.
Thanks everybody for the help on the previous question.
I have my exam on 30/4 and have few doubts:
1) class Tes {
public static void main(String args[]) {
for(int i=0; i < 2; i++) {
continue;
System.out.println("Hello World");
}
}
}
why does it give compiler error?

2) public class Test {
public static void main(String args[])
{
Float f = new Float(32D);
System.out.println(f);
}
}
Why is the Output 32.0 ?My understanding is that a Float wrapper class can take a float assignment value. Then why does passing a double value does not give error?
3) Does Object class implement Cloneable interface?
4) A non-static inner class is accessible from any other class(T/F)?
5) Is << a signed shift operator?
class Base {
int value = 0;
Base()
{
addValue();
}
void addValue() {
value += 10;
}
int getValue() {
return value;
}
}
class Derived extends Base {
Derived() {
addValue();
}
void addValue() {
value += 20;
}
}
public class Test {
public static void main(String args[])
{
Base b = new Derived();
System.out.println(b.getValue());
}
}
Why is the output 40? Can anybody explain?
Thanks.
------------------
Hi Neol,
I know the site. The answers are given but the description of the answers are not given. I want the explanation of the answers.
Thanks,
Anita
Hi,
Does anybody have a detailed explanation of anilbachi's quiz questions answers?
Kindly e-mail me at the earliest as I'll be sitting for the exam this month.
Thanks,
Anita