Sangi

Greenhorn
+ Follow
since Jun 14, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sangi

He is the question again,
Given the following variables which of the following lines will compile without error?
String s = "Hello";
long l = 99;
double d = 1.11;
int i = 1;
int j = 0;

1) j= i << s;
2) j= i << j;
3) j=i << d;
4) j=i << l;
The correct answer is 2 & 4.I thought that it was only 2.Can anyone explain why it 4 too?Does'nt it apply arithmetic promtion here?Please help me.
Thanks
Sangi

[This message has been edited by Jim Yingst (edited June 15, 2000).]
Given the following variables which of the following lines will compile without error?
String s = "Hello";
long l = 99;
double d = 1.11;
int i = 1;
int j = 0;

1) j= i <<s;>
2) j= i<<j;>
3) j=i<<d;>
4)j=i<<l;>
The answer is 2 & 4.But my answer is only 2.Can anyone explain why it is 4 too.Does'nt it apply arithmetic promotion here?
Please help me.
Thanks
Sangi
Q12.What best describes the appearance of an application with the following code?
import java.awt.*;
public class FlowAp extends Frame{
public static void main(String argv[]){
FlowAp fa=new FlowAp();
fa.setSize(400,300);
fa.setVisible(true);
}
FlowAp(){
add(new Button("One"));
add(new Button("Two"));
add(new Button("Three"));
add(new Button("Four"));
}//End of constructor
}//End of Application

1) A Frame with buttons marked One to Four placed on each edge.
2) A Frame with buutons marked One to four running from the top to bottom
3) A Frame with one large button marked Four in the Centre
4) An Error at run time indicating you have not set a LayoutManager

The answer is 3.
The default layout manager for a Frame is the BorderLayout manager. This Layout manager defaults to placing components in
the centre if no constraint is passed with the call to the add method.I understood this.But what happens to the other three buttons?Can anyone help me?
Thanks
Sanju