Mary Anitha

+ Follow
since Oct 13, 2000
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 Mary Anitha

I have also joined the community of SCJPs on Nov 18,2000.
I am satisfied and happy with the score of 76%.
With the help of my one year old daughter who used to constantly turn my pages, I enjoyed studying RHE( the only book i studied apart from the material on the web)
I concentrated on IO the last 2days as I was poor in it and scored 100%. So if u feel a topic is difficult, dont let it master over you instead master it and u will crack the exam.
On the night before the exam , I went thru marcus green's tutorial and the topic wise questions, which I feel helped me buid confidence.
I did rather very badly in awt section.the questions on layout.
threads was OK. I got theory many theory questions about wait() sleep() yield() etc.
Time was enough, i had 20 mts to review.All the SCJPs earlier have given almost the exact picture of the exam.
I am very grateful to JavaRanch and its members. I was very much motivated to write this exam after visiting this site.
All the best to the SCJP aspirants in their exam and SCJPs in their career.
Mary Anitha
22 years ago
We cannot declare static variables inside a method
coz the scope will be limited to that method

If so, will it call any static method called or only main method?

I tried running just the innerclass but it always gives the exception in thread main Nosuchmethod error
I tried something like
public class Test {
public class Inner1{};
public static class Inner2{}
java test$Inner1
java Test$Inner2
if you run obj1$obj2 you get
can you or somebody tell me why I am getting an exception

[This message has been edited by Mary Anitha (edited November 16, 2000).]

Originally posted by Bob Lulyk:
newName = "Jason"; // REPLACES REFERENCE TO "Nick"
// "Jason" OBJECT, MAKING "Jason"

I agree with everything except that the object which can be GCed is Nick and not Jason
But the answer is 1
Congratulations kourosh
Good luck in your career
Mary Anitha
22 years ago
1)The order of the modifiers does not matter.
final public static void main (String args[]) or
static final public void main (String args[])
is fine

2)void main() , int main(int i) etc. work fine but they do not act like the main that we want.
You would easily know the answer by compiling and running the code. As for the explanation, it goes like this...

Strings are immutable i.e., they cannot be changed.
composite.concat("world") does not change composite
if it was composite=composite.concat("world") then it would have changed to "hello world"

String space = " ";
String composite = space + "hello" + space + space;
// " hello "
//doesnot concat since strings are immutable
String trimmed = composite.trim();
// removes spaces "hello"
System.out.println(trimmed.length()); 5
I agree with Kourosh regd answer to Ques1 . The string "bye" is
referenced by d before b points elsewhere.
so I think it is eligible for GC only after line (3) when d no longer points to it.
public class test {
public static void main(String args[]) {
Integer intObj=Integer.valueOf(args[args.length-1]); //args[1-1] will have 2 intobj's value will be 2
int i = intObj.intValue();//i=2
if(args.length > 1) //False
if(args.length > 0) //True
System.out.println(i - 1); //2-1 ie 1 will be printed
System.out.println(i - 2);
I would like to add that
methods in an interface are implicitly public and abstract

Originally posted by Bin Zhao:
Yes,variables in interface implicitly are public,static final.

Originally posted by Kourosh Keshavarzi:
In general what modifiers are allowed to be used if you want to overide the default modifiers.

In general default,protected or public are allowed to override a method with a default modifier

[This message has been edited by Mary Anitha (edited October 28, 2000).]
In your code the error I think is only because you are making it more restrictive(ie private) but not because you are overriding a static method.
The rules that I learnt are that
A static method cannot be overridden as non-static.
A non static method cannot be overridden as static.

The error must be because the System.out.println(m2 );
was directly under the class instead of being in a method.
[This message has been edited by Mary Anitha (edited October 27, 2000).]
The RHE book says
there is no guarantee that the listeners will be notified in the order in which they were added.
So I think that the answer should be false