rubna

Greenhorn
+ Follow
since Jun 15, 2000
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 rubna

Hi,
This is the question from marcus
Which of the following will compile without error?
String s = "Hello";
long l = 99;
double d = 1.11;
int i = 1;
int j = 0;
The answer is j = i << j and j = i << l
I understood the first answer j = i << j. But why is the answer j = i << l correct? I thought that b'coz of arithmetic promotion, i << l is promoted to long & how does it fit into j? Can anybody please help me with this?
Thanks
rubna
[This message has been edited by Jim Yingst (edited July 10, 2000).]
Hi,
Here is a question from Marcus
Which of the following are legal statements?
1) float f=1/3;
2) int i=1/3;
3) float f=1.01;
4) double d=999d;
The correct answer is 1,2,4.
I compiled & got it correct too.But i have a small doubt.When u say float f=1/3,why does'nt it consider 1/3 which 0.3333 as double.We know that the default type for decimal type is double.Why does'nt it give an error for No.2 option too?I have the same doubt here.Can anyone please make it clear for me?
Thanks
Hi,
Can anybody please give me the link for Marcus exam-3?
Thanks a lot
rubna

Originally posted by Marcus Green:
The reason I try to include entire classes in questions is so you can compile and try it yourself to see what happens. It is a great way to learn.
Marcus


Thanks,
I tried compiling,but i did'nt get any error.That's why i was confused.I thought that it would give a compiler error telling
private constructors cannot be instantiated.
Thanks,i got it.
Here is a question from Marcus
public class StrEq{
public static void main(String argv[]){
StrEq s = new StrEq();
}
private StrEq(){
String s = "Marcus";
String s2 = new String("Marcus");
if(s == s2){
System.out.println("we have a match");
}else{
System.out.println("Not equal");
}
}
}

The correct answer is "Not Equal".But according to RHE,the private constructor cannot be instantiated.Here,dont u think that it gives compiler error since the private constructor is instantiated?Please help me.
Thanks
rubna

Originally posted by Nirmal:
Hi Rubna,
For Decimal to Octal:


Thanks a lot.

Originally posted by Carl Trusiak:
[B]
[/B]


Thsnks a lot Carl.
Hi,
Does anyone know how to convert Hexadecimal to Decimal & octal to decimal?If so,please help me.
Thanks
rubna
The question which i came across in a mock exam is
int a=6,b=7,x;
x= a++ + b++;
The answer is x=13,a=7,b=8
I have a small doubt.We know that the unary operator has the highest preference & then Arithmetic operator.Here,dont u think that 7 and 8 gets added to give the result as x=15.
But the correct answer given is x=13.
Can anybody please clarify this for me?
Thanks a lot
rubna
Thanks Paul.The site which u have suggested sure did help me. Do u know any book or site that in detail about GridBaglayout?I need to prepare for the exam.Please help me.
Thanks
rubna

Originally posted by Paul Smiley:
Look from here: http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html
Even though this is a Swing tutorial, it covers the GridBagLayout. Yes, it is distinct from GridBag in a big way. You will have to know both for the exam.
[This message has been edited by Paul Smiley (edited June 25, 2000).]


I tried compiling
Hi,
Consider
Float f=new Float(10.34d);
It did'nt give any compiler error as Explicit cast needed.
But,when i tried compiling
Integer i=new Integer(10.34);
It gave a compiler error stating-explicit cast needed to convert int to float.When i replaced by Long,it gave me the compiler error again.
Is there any differnce of compiling for Integral & floating point types?Can anybody explain what is happening in the above statements?
Thanks
Rubna
Hi,
Could u please help me out in telling me what is GridBaglayout?I dont have any reference book for this.Can anybody suggest me a site or book for doing this?How is Gridbaglayout different from Gridlayout?Please help me.
Thanks
Rubna

Originally posted by Herbert Maosa:
Hie Rubna,
Your question :


Thanks a lot Herbert.U made it clear for me.
I have a small doubt here about the correct answer
class Base
{
void test() {
System.out.println("Base.test()");
}

}

public class Child extends Base {

Child(int i) { test (); }

Child(float f) { this ((int)f); }

void test() {
System.out.println("Child.test()");
}

static public void main(String[] a) {
new Child(10.8f).test();
}
}
The correct answer is Child.test() Child.test().
I compiled it too & got the same answer.
But when we call the constructor Child(float f),does'nt it try to call the default base class constructor?I thought that it would give the compiler error by saying that there's no match for base class constructor super()?Can anybody please verify this for me?
Thanks,
rubna
Can anyone please help me in suggesting me how much to study "Collection" topic.Do we have to study the whole of util classes?
Thanks
rubna