Ranjan Sarangi

Greenhorn
+ Follow
since Jun 16, 2000
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 Ranjan Sarangi

Yup. The book is very much helpful.
Dear All,
I'm selling my Exam Cram book (by William Brogden). As you know this is the best among the lot and a must for SCJP exam.
If you (preferably in MD, DC, NY, NJ, VA or around) are interested please email me (sarangir@nasd.com) or pass on the message to other interested folks. I'll give this @ $22. (I got @ $32). Do not worry about shipping. I'll bear that.
Cheers
Ranjan
301-721-1178
------------------
Ranjan, Rockville, USA
Thanks Manal for congratulating me.
In fact most of the credit goes to my friend Milind Kulkarni who constantly kept beefing up my knowledge-base.
I started with Thinking In Java ( Downlaod Free from net).
Then I read Java2 Certification book (RHE).
Then I read Exam Cram (Bill Bordgen).
Then I went through a lot of mock exams. Following are some sites for mock exam. http://java.about.com/compute/java/gi/dynamic/offsite.htm?site=http://www.software.u%2Dnet.com/jcertfaq/jcertfaq.htm http://java.about.com/compute/java/mbody.htm http://java.about.com/compute/java/msubcert.htm http://metalab.unc.edu/javafaq/links.html http://209.242.122.83/JavaCertification.html
Thanks Ajith,
I will stay around to help others in getting there. I owe things to give back to the forum.
Ranjan.
I wanted to thank you all for running such a great forum which is brimming with values.
A special thanks to Milind Kulkarni and William Brogden for resolving my doubts.
Milind had/s solution to every aspect of Java at any point in time. Thanks Milind buddy.
William Brogden's cram book is a REAL CRAMER.
Cheers.
Ranjan
301-721-1178.
Thanks Bill and Sanjeet for drawing line between the compile time and run time checks.
Bill, Currently I'm reading your cram book. It's a great resource. I'll appear the exam shortly. It's a pleasure that you responded to my questoin.
Thanks.
All, This one may look easy for some. But at first sight it is confuses. Try the following.
int i=10;
// Following need explicit cast in order to get compiled.
char c=i; byte b=i; short s=i;
//But Following works fine - compiles well.
char c=10; byte b=10; short s=10;
My school of thought would say : As long as the value of RHS is in range of the LHS type, it should not need explicit cast no matter RHS is a variable or value.
Would someone please justify this behaviour of JVM!!!
Another thing - in a mockexam (http://valiveru.tripod.com/java/jvaltest.html) the following declaration is said valid. (which I tested does NOT compile)
int i=10; char c=i;
Are these site authenticated? This site has very tough Qs and added to that couple of wrong answers like above. Testing yourself at these site might be frustrating. Just a breather to concerned ones.
As you know during shift operation of short variable, first it is converted to int. The result is also int. The ideal statement should look like : s = (short) (s >> 10); However I see something strange below.
short s=-1;
s >>>= 10 ; // this does not need explicit cast.
//s = s>>> 10 ; // but this does need cast.
Why? Any body.
Hello Friends
My answer would be C and D. That means either of them will suffice. Agreed that only D also suffices coz it specifies mother of all exceptions.
Just read the Question. "Which of the following ARE legal?". So I would add C to the answer also.
E is definitely not correct. Bcoz E catches only RuntimeException which is, as all of us know, redundant and more importantly it ignores the BaseException and Exception which are bound to be caught/declared in this case.
Any affirmation?
Could somebody please clarify why any modifier other than public in the following pgm results in compile error...
Are those modifiers (private, protected, friendly(no-modifer)) applicable only to methods and variables not classes?
//Fred.java
public class Fred {
private int x = 0;
private Fred (int xval) {
x = xval;
}
}
Vivek,
You are right. I also remember the exact words being discussed before. The Test in class Third can not throw any checked exception because the Test in class Second does not throw any.
I failed to compile when I put an exception in throws clause of test in Third. The error was -
C:\Java\First.java:13: The method void test() declared in class Third cannot override the method of the same signature declared in class Second. Their throws clauses are incompatible.
void test() throws Exception1{ }
^
1 error
Process completed with exit code 1

When you take out the throws clause it compiles well.
So Answer is defiinitely c.
Thanx.
Satya, I tried to send you email. But it returned. If you do not mind could you please send met the same stuff(MINDQ). Thanks in Advance. my email id is ranjan.sarangi@nasd.com or sarangir@nasd.com
forgot to put the results. Here are they -
before equating : b.equals(q)=false ( b==q) is false
after equating : b.equals(q)=true ( b==q ) is true
My answers would also be C and D.
However, I tried a small pgm and concluded that -
1.equals() returns true if both content and reference are same.
2.== returns true if just the refernces are same. which in turn makes the contents to be same too. right!!!
Any thoughts?
class Base {int i = 10;}
public class myjava {
private static void main(String [] args){
Base b = new Base();
Base q = new Base();
System.out.print( "before equating :");
System.out.println("b.equals(q)=" + b.equals(q) + " (b == q) is " + (b==q));
q = b;
System.out.print( "after equating :");
System.out.println("b.equals(q)=" + b.equals(q) + " (b == q) is " + (b==q));
}
}