jeena jose

Ranch Hand
+ Follow
since May 06, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by jeena jose

i am scjp with 96%.i have three years experience in c.
is it worth to study JSP and XML before trying for a job?i know market is little dull.can someone give me proper guidence???
23 years ago
i became scjp now.i got 57/59.i found exam easy than i expected.jq+ is a good tool for exam.i spend two weeks on jq+,i got 88-93% for that exams.i read all optional and generall comments on each question. i haven't read any popular guides for exam.exam is easy,only thing is you should open your eyes and read questions carefully.don't forget to take sun's mock questions before taking scjp.thanks to all rancher's for helping me.i was not an active member,but this site helped me a lot.
23 years ago
1. class Widget extends Thingee{
2. static private int widgetCount = 0;
3. public String wName;
4. int wNumber;
5.
6. private static synchronized int
addWidget(){
7. return ++widgetCount;
8. }
9. public Widget(){
10. wNumber = addWidget();
11. }
12. }
this code will give unique value of wNumber for each Widget object created in multithreaded environment.
my question is if i remove static keyword from addWidget method will it give unique values for wNumber???
if you are extending an abstract class either you have to implement the abstract methods in super class if any or you have to declare the subclass also as abstract.
in first case you are implementing abstract method in the super class in subclass,so you don't have to declare the subclass as abstract.
but in second case you are not implementing the abstract method in super class, so you have to declare sub class also as abstract.
all checked exceptions should be handled,either with throws clause in method signature or with try-catch block.otherwise compile time error.
if you are adding throws clause in method signature,the error has to be caught when method is called,other wise it will propagate and end up with runtime error.
in this case you have to use try-catch to make the program run fine.since exception is set to null,null pointer exception will be thrown instead of Exception.
anyone please consider this query
thanks Mikael.
sometimes we miss points that we know.
so i repeat once again:
when we extends Thread class we are implementing Runnable interface also and RunHandler is getting a run method by inheritance.
what must be true for the RunHandler class in this code???
class test{
public static void main(String[] arg){
Thread t=new Thread(new RunHandler());
t.start();
}
choices:
a.RunHandler must implement java.lang.Runnable interface.
b.RunHandler must extend the Thread class
c. RunHandler must provide a run method declared as public and returning void.
answer is a and c
my view points:
code will work if RunHandler implement Runnable interface or extend Thread class.so a and b are not correct.if the RunHandler extends Thread it implements Runnable interface so it is not a must that RunHandler should have a run method.
jane,
i am sorry,i couldn't find that link in menu.
please help!!!can you just go through that site and send me that link?i am taking SCJP exam on 16th.one more query???i tried Jxam.will it display the answer after ansewring all 200 questions,or after every 59 questions??there is a menu item title exam summary.it is not working after answering 59 questions.
how can i get answers for boone's mock exam???
do we need to put the answer for fill in blank question within double quotes "" ???
thanks sona.explanation for I/O was helpful
if you are creating an object as instance variable and not setting its reference to null,how can it be eligible for garbage collection???i think i am missing something here!!!
1. class Mine extends Sssh {
2. int z;
int i;
3. public static void main(String[] args) {
4. Mine m1 = new Mine(); m1.i = 5; m1.z = 12;
5. Mine m2 = new Mine(); m2.i = 5; m2.z = 12;
6. if (m1.equals(m2))
7. System.out.println("YES");
8. else
9. System.out.println("NO");
10. }
11.
12. public boolean equals(Object ob) {
System.out.println(z); // Line 1
13. if (z != ((Mine)ob).z)
14. return false; // line 2
15. return super.equals(ob); //line 3
16. }
17. }
Ans: IT IS IMPOSSIBLE TO KNOW.
problem:
1. why is the answer impossible to know.
ans. we don't know about super class equals method.
2. Line1 access which instance of z , ie, m1.z or m2.z . I tried giving a print statement and found that it accessed m1.z(Here the values are same. I gave diff values) . Why is it is accessing m1.z value?
ans. you are calling equals() metod on instance m1,so 'this'
points to m1. Try with m2.equals(m1).
3. Line 2 where is this return going to (I mean it is returning to which line?)
ans. return type is boolean here,so if you give
boolean b=m1.equals(m2);//b will get the return value
4. Line 3 -- can there be 2 return statements.
ans. it can contain any number of return statements,but take
care that all statements are reachable
so if you create an instance variable of an object and if its reference is not set to null,will it result in memory leak???