Shaily Sharma

Ranch Hand
+ Follow
since Sep 10, 2007
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shaily Sharma

hi all,
there is a nice way to use constants defined in a class to use it in another class.(applicable for java1.5 onwards).
here it goes:

public class Constants {
//Constants for other classes
static final String HOST_NAME = "host_name";

import static Constants.*;
class UseMyConstants {
String hostname;

hostname = HOST_NAME;


all d best...
14 years ago
some nice quotes:
"Matter matters when mind minds......"

From the author of "Monk who sold his ferrari.."
Dare to dream that you are more than the sum total of your current circumstances. Expect the best!
15 years ago
Hi all,
I am using XPathAPI. after that I refered a link
which says the operations are pretty expensive.
So could anyone please tell me which one is good approach DOM parser or XPathAPI?

Thanks in advance.
Hi all,
Could any one please share the link or .zip file for servlet n jsp tutorial. I need to get conversant with Servlet n jsp APIs....
Please do help.....

Thanks in advance.
Superb score in both exams!!!simply Gr88
Hey please do share with us your sucess tricks and tips.
Please send us gud study material n mock exams. Thanks in advance!
15 years ago
hi all,
If anyone has material for code examples for WCD chapters, pls share here.
Thanks in advance
Hi All,
could anyone pls tell me the significance of
"trans-attribute" if set to:
1) "NotSupported" :
2) "Supports"/"Required"(difference?):

I have written MDB which has DB transaction to populate values from DB table, which attribute is suitable in this scenario.

Thanks in advance.
Hi all,
I cleared SCJP1.5 with 79%.
Thanks all for your support and quick query resolution.....
Now planning for SCWCD1.4 ..
16 years ago
Hey Congrats!!! Amazing score....

I recently cleared SCJP1.5 exam and now wanna go for SCWCD1.4....
Pls do me a favor, pls share mock exam Q's and your exam scoring tips!!!
16 years ago
Hi all,
Can anyone pls tell me why wrapper variables are not treated as
constants even those declared as static final. They are not allowed to e part of case expr in switch.

public static final Integer x =9;
Hi all,

public static final Integer x =9;
11. class ClassA {}
12. class ClassB extends ClassA {}
13. class ClassC extends ClassA {}
21. ClassA p0 = new ClassA();
22. ClassB p1 = new ClassB();
23. ClassC p2 = new ClassC();
24. ClassA p3 = new ClassB();
25. ClassA p4 = new ClassC();
Which three are valid? (Choose three.)
A. p0 = p1;
B. p1 =p2;
C. p2 = p4;
D. p2 = (ClassC)p1;
E. p1 = (ClassB)p3;
F. p2 = (ClassC)p4;
Answer: AEF

this is a mock exam question. I am not convinced with the answer.
"=" oprator for object references connotes to equivalence of object the reference variable pointing to... if both are pointing to same object then they can be said equal. as per this understanding how p0=p1 is valid answer?
1) Question;
11. public String makinStrings() {
12. String s = ���Fred���;
13. s = s + ���47���;
14. s = s.substring(2, 5);
15. s = s.toUpperCase();
16. return s.toString();
17. }
How many String objects will be created when this method is invoked?
A. 1
B. 2
C. 3
D. 4
E. 5
F. 6

When we invoke substring() method does it create new String object and make s to point to it? In that case 5 objects should be there.
16 years ago
1) When does an overloaded constructor gets invoked, without explicit call to it from default constructor.

2)List list = new ArrayList();
Iterator<String> it = list.iterator()
From where does iterator() method comes? ArrayList() doesn�t implement this method, list has it but how its possible to invoke it, as interface doesn�t provide its implementation, how can we invoke this method?

3) Mock exam drag n drop question:
String str = �April 15, 2005�;
Date date = DateFormat.__________(_________, Locale.US).____________(str)
Code Fragments: DateFormat.FULL , getDateInstance, parse, getDate, format ,getDateFormat, DateFormat.LONG, DateFormat.SHORT

if i put parse option in last slot it gives parseException. wats the correct way?
class Ex4{
1.public static void main(String[] args){

2.String s = "-";
3.Integer x= 343;
4.long L343 = 343L;
5.if(x.equals(L343)) s+=".e1";
6.if(x.equals(343)) s+= ".e2";
7.Short s1 = (short)((new Short((short)343))/(new Short((short)49)));


10.if(s1<new Integer(7+1)) s+="fly ";

Wrf to Example4, chapter 6, its bit confusing to understand type conversions ..
1)how can we compare a Integer object with Long object resulted in line no.6
2)On line no 8, why do we need to convert to short, in place of that can we use �Short�.
3)On line 11, how does comparison happens? Specially its comparison of 2 different wrappers.

2) is-a relationship always rely on polymorphism? Can anyone pls explain this statement

3) What does exactly happen when a code between try and finally (there isn�t any catch block) throws an Exception?