madhu raina

Greenhorn
+ Follow
since Oct 29, 2001
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 madhu raina

class Test {
static int a=5;
static int b=a;

static
{
this.a = ++a;
}
public static void main(String[] args) {
System.out.println( a + b );
}
}
Prints 11. True or False?
Given the following class definition in a file named MyClass.java,

import java.io.IOException;

public class MyClass{
int i;
public void amethod(){

try{
i = 10;
i++;
throw new IOException();
i--;
}
catch( IOException e){
i++;
}
finally{
i--;
System.out.println("i is : "+i);
}
} //end of amethod()

public static void main(String[] args){
MyClass mc = new MyClass();
mc.amethod();
} //end of main
} //end of class MyClass
What happens when we try to compile and run MyClass.java.
A.Code does't compile because of error Statement not
reached.
B.Code doesn't compiles because IOException cann't be
thrown explicitly
C.Code compiles & runs with output
i is : 11
D.Code compiles & runs with no output.

not sure of answer pls explain
Given the code, what is the output
public class MyClass{
static int i = 10;

public static void main(String[] arg){
static int i = 20;
System.out.println("i is :"+i);
}
}
A.Code Does't Compile.
B.Code Compiles but error will be generated at runtime.
C.Code Compiles & runs, output is
i is : 10
D.Code compiles & runs, output is
i is : 20
pls explain
Question 4.
To increase size of a button in a Frame with GridBag Layout manager as its Layout manager, which of the following best describes what you do.

A.We can't do any thing like this irrespective of the layout
policy of the container.
B.Use setFill method of GridBagLayout class.
C.Use setFill method of GridBagConstraints class
D.Use fill() method of GridBagLayout class.

The correct answer given is D but i think it is wrong!
pls explain
thanx a lot in advance
How many String objects are created when we run the following code.
String s1,s2,s3,s4;
s1 = "Hello";
s2 = s1;
s3 = s2 + "Pal";
s4 = s3;
i think 2, but the mock exam answer says 3 pls explain.
Thanx in advance
pleaz let me know inif this class declaration is invalid
public myclass extends Object
{
.....
weighty feild in case of the gridbagconstraints class specifies the distribution of extra horizontal space of a component,but there is one question in the book Khalid Mughal's sample test where it says that it specifies the extra vertical space distribution of a component pleaz help i m confused,but i still think that answer in book is wrong.
Can u pleaz tell me tthat wether we can use this key word with the static variables.
Can u pleaz let me know about more in detail regarding the type of questions aksed in Sun exam about util & lang Package.