• Post Reply Bookmark Topic Watch Topic
  • New Topic

few questions ...  RSS feed

Ashish Agnihotri
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Can an applet "test" the system to determine its access
2) What is purpose of java.text.package?
Is it only to do with formatting ( geographical locations ) ?
3) Does following seem to be a bit tricky one ? To me it did�
class A {

private int x=0;
public synchronized void update() { x++;}

public class B {
public synchronized void update() {
synchronized (A.this) { x++; }
What would happen if the following code was executed: and why ?
A a = new A();
A.B b = a.new B();
1) �b" would acquire its own monitor and then increment "x"
2) There would be a compiler error
3) would acquire its own monitor and update "x"
4) would acquire the monitor of "a" and increment "x"
5) would acquire both the monitors of "a" and "b" and
increment "x"

4) See following and answer ...
double dd;
java.util.Random r = new Random(33);
dd = r.nextGaussian();
After execution, double dd contains a value that is distributed approximately ________ with a standard deviation of ________ and mean of ________.
I put in uniformly, 1, 33 resp.. but its wrong I know.. can somebody put correct answers ?
5) What is JAVAKEY TOOL ? What is its purpose ?
6) See following code :
public int m1(int x) {
int count=1;
try {
count += x;
count += m2(count);
catch(ArithmeticException e) { count -= x; }
finally { count += 3; }
return count;
What happens when m1(2) is invoked ?
7) Which statement would cause a thread to relinquish control of an object's monitor to other threads until "condition" is satisfied?
do { Thread.yield() } while(!condition);
while(!condition) { wait(); }
8) What code will store StringBuffer "str" in file "st"?
FileOutputStream f=new FileOutputStream("st");
ObjectOutputStream o;
0 = new ObjectOutputStream(f);
ObjectOutputStream o;
o=new ObjectOutputStream(new File("st"));
I have my own answer for all but one ! but am not still feeling confident of making it public. May be will be capable of doing it shortly..
tks in advance,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!