Originally posted by vasu matt:
hello everybody
can anyone of u please explain me the answers for these questions.I am actually very confused.
code:
1)
Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?
1)the rectangle drawn will have a total width of 5 pixels
2)the rectangle drawn will have a total width of 6 pixels
3)the rectangle drawn will have a total width of 10 pixels
4)the rectangle drawn will have a total width of 11
2))public class Qcb90 {
int a;
int b;
public void f() {
a = 0;
b = 0;
int[] c = { 0 };
g(b, c);
System.out.println(a + " " + b + " " + c[0] + " ");
}
public void g(int b, int[] c) {
a = 1;
b = 1;
c[0] = 1;
}
public static void main(String args[]) {
Qcb90 obj = new Qcb90();
obj.f();
}
}
1)000
2)001
3)010
4)100
5)101
ans:101pixels
3)Which statements concerning the following code are true?
class A {
public A() {}
public A(int i) { this(); }
}
class B extends A {
public boolean B(String msg) { return false; }
}
class C extends B {
private C() { super(); }
public C(String msg) { this(); }
public C(int i) {}
}
1)the code will fail to compile
2)the contructor in A that takes ine as arg will never be called as a result of constructing an object of class B or C
3)class c has three constr
4)objects of class B cannot be constructed
5)at most one of the constructor of each class is called as result of constructing an object of class c
regards
vasu
Originally posted by Sudha Kris:
Some slight error in the code.
please change & try
public class test{
static String output ="";
public static void main(String args[]){
output = methodA();
System.out.println(output);
//It Prints just BE not BCE why??
}
public static String methodA(){
try{
Error();
return output+="A";
}
catch(Exception e){
output+="B";
return output+="E";
}
finally{
output+="C";
}
}
public static void methodE()throws Exception{
throw Exception
}
}
If I put a print at finally it prints output as BC.But when it returns to main that C isn't there. It just prints BE.
Can anybody explain this. Is it something to do with String being immutable?But then we are reassigning it to the same. So it should print the conactenated one.
Thanks
Sudha
Originally posted by Sheldon Rego:
How do U basically distinguish between a Java class and a Java Bean on a technical level as there are a lot of debatable points if some could please elaborate on this topic
Originally posted by Sam:
Consider the following code :
class ABC
{
public static void main(String gh[])
{
int i=0
i=i++
System.out.println(i);
}
}
Guess the output !!!
Its 0 even after incrementing befre printing. Why guys, I wanna
know !!!
Help out.
regards,
[This message has been edited by Sam (edited November 06, 2000).]
Originally posted by sudha:
[B]Hi
This is from deepak's mock
Consider the following code :
1. int [ ] a = new int[ 2 ];
2. int b = 1;
3. a[b] = b = 0;
Value will be stored in what element of array a.
A.a[1]
B.none
C.a[0]
Answer given was a[1]
How can it be a[1].I didn't get this.Can any of you please explain.
Regards
Sudha