mohana konakanchi

Ranch Hand
+ Follow
since May 16, 2001
Merit badge: grant badges
For More
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 mohana konakanchi

Yep. It's big topic.

I follow this way.

For application expections (ex: minium age should be 16 years, throw exception if age is less than 16 years), create you own checked application exception and throw it.

For system exceptions create unchecked exception (extends Runtime Exception).

Above rules works for me.
18 years ago
Any subclass can act as parent class. Let's say if you have parent class P and you have two classes extending parent class(C1,C2).

You can typecast back to C1 or C2 to P and call methods belong to P.

In your case, you can typecast from parent to child or child to parent.
But not from C1 to C2 or viceversa.

If change desing as C2 extending C1, C1 extending P, You can call C1 methods from C2. Or

You can use reference of C2 in C1 to call methods on C2.
18 years ago
I got this code from web.

You can use the org.apache.xerces.impl.Version class in Xerces. For
instance, this is the code that XOM's Builder class uses to check the
version:

try {
String versionString = Version.getVersion();
versionString = versionString.substring(9, 12);
xercesVersion = Double.valueOf(versionString).doubleValue();
}
catch (Exception ex) {
// The version string format changed so presumably it's
// 2.6 or later
}
catch (Error err) {
// Xerces not installed, so none of this matters
}
We have developement, staging, production environments which uses
apache xerces on each box. We had error while tranforming XML to HTML in staging and working fine in others (not able to trace the error message due to high volume data). Same code is deployed in all boxes.

Is there as way to know the version number of Xerces used on runtime? so that we can make sure different boxes running same version of Xerces.
String message = //form string out of your xml message.

//create text message.
TextMessage textMessage = session.createTextMessage(message);

Then send the textMessage.
public void add(int a) {
loop: for (int i = 1; i < 3; i++){
for (int j = 1; j < 3; j++) {
if (a == 5) {
break loop;
}
System.out.println(i * j);
}
}
}
Why does above method does not print anything if called with 5 as argument?
Math.ceil(-0.0) results -0.0 (negative zero)
Math.ceil(-0) results 0.0 (positive zero)
Match.ceil does not have any overload methods. It takes doubletype as argument and returns double type.
So -0 should be converted to -0.0 and the result should be -0.0. Where as it gives 0.0 (positive zero)
Why is this behaviour? Any inputs?
3. What class must an inner class extend:
A. The top level class
B. The Object class
C. Any class or interface
D. It must extend an interface

Anonimous InnerClass should extend atleast one class or implement atleast one interface. Where as for inner class with name it's not manditory to extends any class(By default extends Object) or implement an interface.
Since anonimous inner Class also an inner class,Both B and C are correct.
If we go by words "extend" and "implement:, Question askes for extend only so B is correct.
I guess I am confused with ambious quesiton itself.
May we need a GURU now.
HI,
Today I brought the Vochur and Scheduled the exam on NOV 15.
Though I have been using Java quite long time. There are lot of concepts which we may never use.
So better read the concepts, If you could able under stand Java Lang Spec. It is best and then take the mock test.
After each mock test, understand the Objects which you are not doing well.
Refress the concepts again on those and try another mock test.
This is how I am doing, I could see good progress this way.
BTW practically writing code is more important way understanding things.
All the best.
Mohana
The rang of long is
For long, from -9223372036854775808 to 9223372036854775807, inclusive
Where as float values can be represented with float-extened-exponent,
which in tern effectively store larger numbers than long primitive range.
java implementation automatically decides where to use float-extened-exponent or not.
In your example, it does need to use float-extened-exponenet.
for example
float f =Long.MAX_VALUE;
System.out.println(f);//will print 9.223372E18
long l=24;
f=1;
System.out.println(f);//will print 24.0

There is a enough room in float-exponential format to store all the rang of long integers.
If I get a question on certification exam 1.4
Should answere assert as keyword or not a keyword.?
I could not find assert keyword in language spec.
Which is correct ans for 1.4 exam.
Is assert java keyword.
or Can i use it for variable names?
like
<code> int assert=0; </code>
We are working on J2EE project where different group of users would have different privileges. Privileges has to be implemented at page/JSP level and also field level(Particular field in the JSP can be visible for particular users only). Same JSP is used for more than one group of users.
We have implemented above requirement with role based privileges. When ever new user id is created, that should be assigned to one of the roles provided.
After completing phase1 work of the project, privilege requirements have been changed.As per new requirement, administrator would create new user id and assign the page level and field level privileges, no roles and user groups would be provide to administrator.
Can anybody through some light on how to implement this kind of dynamic privileges for each user id ? Client is adamant on his new requirement.
Hi

I need to implement printing of a document( WORD or EXCEL document) on click of an html link.
Each html link will be related to one document.
Type of the document is not same for all the links.
If anybody have solution or implemented already.
Please let me know
Thanks in advance
Mohana
22 years ago
JSP