jayu jadhav

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

Recent posts by jayu jadhav

But in KAM book, on page 161,there's an example of same kind where try blk throws excpn at first line and catch is executed.
The explanation is also like THE REST OF THE TRY BLK IS NOT EXECUTED.
Then why compiler error in above code?
Then look at the code:
int i= -20;
final int j=20;
final int k=i;
byte b1=j; //works
byte b2=(byte)i; //cast required
byte b3=(byte)k; //cast needed
Why is cast not required when source is final int? i. e. can you explain about b1 and b3?
Thanks.
[This message has been edited by jayu jadhav (edited July 18, 2001).]
In Container class:
public Component add(string name,component)
Container keeps track of all the compo.s. added.
Borderlayout keeps it's own internal list of container's components & DOES NOT ask the container for the list of compo.s
Also it's true with the borderlayout that only the last compo. added to a region is shown.
Whereas Flowlayout asks the container for list of all compo.s.
I really want to know about the sheet of paper given for rough work.
Thanks.
Hi all
I would like to get some last minute tips for SCJP exams.
Any suggestions,information regarding the exam environment,paper given for rough work, timing, tension build-up, any traps(!),after-exam tips, and so on .
Thanks.
I have downloaded JSDK server from Sun.
startserver.bat file exists,but the command startserver is not working.It gives error bad command or file name.
What should I do? Any help will be appreciated.
Thanks
23 years ago
Given the following definition:
String s = null;

Which code fragment will cause an exception of type NullPointerException to be thrown.


1) if ((s != null) & (s.length()>0))

2) if ((s != null) && (s.length()>0))
3) if ((s != null) | (s.length()>0))
4) if ((s != null) | | (s.length()>0))
5) None of the above.
Ans given are-1,2,3,4
Explanation given by them:
((
This question revolves around the short-circuit logical operators (at least some of it does!).

For the following, LHS is left-hand side, RHS = right hand side.

Answer 1 must be fully evaluated. The LHS is true and so the RHS needs to be evaluated to ensure the entire expression is true. This is an AND operation, and if the LHS is true, then the RHS must be evaluated for the expression to be true.

Answer 2 is the same as above. Both sides need to be evaluated for an AND expression to be true (if the LHS is true, that is)..

Answer 3 must be fully evaluated because an OR expression is only true if one or the other is true, but not both. Therefore, since the LHS is true, the RHS must be evaluated.

Answer 4 is similar to answer 3 above.

For someone like me with 14+ years of software experience, this was a tough question! It requires that you are familiar with AND and OR truth tables, as well as Java.
))

Is the explanation right?

Can you get MANY pieces of paper,or they just give ONE? Also what size?
-Thanks.
Hi all, this is a q. from JQ+.
What statements regarding the following code snippet are ture?
int a = 4;
int b = 6;
System.out.println( a--b ); // ie. a (no space) minus (no space) minus (no space) b

options are-
a. It will print 10
b. It won't compile
c. It will compile if a--b is replaced by a- -b
d. It will compile if a--b is replaced by a---b
e. It will compile if a--b is replaced by a+-b
ANS. are b,c,d,e.
They have given explanation,but I want more explanation for this
--Thanks.
Hello all,
I am going to appear for SCJP.
I have solved JQ+ tests and got around 70-80 % scores.
But I failed the very tough test.
Am I ready for the exam?
Also how many times should I solve the tests in JQ+?
Do the JQ+ people update their question bank regularly?
( I mean if I purchased the s/w a month back, will it be useful to buy it again, hoping to get new q.bank!)
-Bye and thanks.
Can anyone tell me link to Velu's notes and any other useful notes for SCJP ?
Thanks.
I HAVE DOUBTS FOR FOLLOWING Q.S FROM JAVACAPS EXAM 1. WILL ANYONE PLEASE CLEAR THEM FOR ME?
THANKS.
10). What is the result when you compile the and run the following code?
public class ThrowsDemo {
static void throwMethod() {
System.out.println("Inside throwMethod.");
throw new IllegalAccessException("demo");
}
public static void main(String args[]) {
try {
throwMethod();
} catch (IllegalAccessException e) {
System.out.println("Caught " + e);
}
}
}
A) Compilation error
B) Runtime error
C) Compile successfully, nothing is printed.
D) Inside throwMethod. followed by caught: java.lang.IllegalAccessExcption: demo

ANSWER IS A. WHY?

11) Which statements about garbage collection are true?
A) The garbage collector runs in low memory situations
B) You can run the garbage collector when ever you want.
C) When it runs, it releases the memory allocated by an object, which is no more in use.
D) Garbage collector immediately runs when you set the references to null.

ANSWERS ARE A,C. WHY NOT B TOO?
26) Which of the following are correct, if you compile the following code?
public class CloseWindow extends Frame implements WindowListener {
public CloseWindow() {
addWindowListener(this); // This is listener registration
setSize(300, 300);
setVisible(true);
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public static void main(String args[]) {
CloseWindow CW = new CloseWindow();
}
}
A) Compile time error
B) Run time error
C) Code compiles but Frame does not listen to WindowEvents
D) Compile and runs successfully.

ANSWER IS A. WHY?
39) Which of the following statements are true?
A) An inner class cannot be defined as private.
B) Static methods can be overridden by static methods only.
C) Static variables can be called using class name.
D) Non static variables can be called using class name.
ANSWERS ARE B,C. WHY B? STATIC METHODS CANNOT BE OVERRIDDEN BUT HIDDEN BY STATIC METHODS.
23 years ago