Win a copy of Terraform in Action this week in the Cloud forum!

Namrata Shetty

Ranch Hand
+ Follow
since Jul 18, 2001
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 Namrata Shetty

I was averaging 78% in the jq+ tests. and i ultimately scored 89%.
Namrata
20 years ago
hi poonam,
If u r faring decently in the jq+ and marcus green then there shud be no problem.
At the end i got only 2questions wrong in the marcus green test. and i was averaging a score of about 78%.
The thing is u shud feel confident that u will definitely pass the exam; scoring depends on luck and preparartion
and as everybody has said on this site, be very calm and read every question carefully.
One thing i did was any question i found was taking to long for me to figure out, i would mark the question and carry on and then after i finished answering all the question I came back to them. This is just a suggestion; u can always comeup your own game plan.
Hope this helps.
Namrata
20 years ago
hi dave,
Thanks a lot for the information
Namrata
20 years ago
I passed the exam on wednesday with a decent 89%. I started using the JavaRanch forum about 3 weeeks ago and found it to be a good & helpful site for clearing your doubts about Java.
Good JOb!!!
I just have a few questions how does a person get graded as a bartender, greenhorn etc.
how does a person qualify to be a moderator??
Thanks,
Namrata
20 years ago
i found the following in velmurugan's notes:
Order of code executin:
a) static variable initialization
b) static initializer block execution
c) constructor header (super or this - inplicit or explicit)
d) instance variabled initialization/instance initializer block (s)
e) rest of the code in the constructor.
hope this helps
i think it's both (i) & (ii)
(i) because if a class has all its constructors private then u cannot create an instance of the class anywhere except in that class itself.

but i thought that default initialization takes place for arrays irrespective of whether they are member variables or local variable.
in fact the following code works just fine
and prints 0
class test2 {
public static void main(String [] args)
{
int arr[]=new int[4];
System.out.println(arr[1]);
}
}
because in your main method u have only one print statement.
u have to create an instance of the other classes for the other print staements to get executed
int i = 5;
short s = 3;
char c = 'a';
byte b = 2;
The following stuff compiles and I don't know why...
s += i;
c += i;
b += i;
the way the above above works is
s+=i; is actually seen by JVM as s=(short)(s+i);
casting is done by JVM whereas
s=s+i; //it needs an explicit cast
similarly for the other cases
u r right. 0.0 gets printed and not +0.0.
i think the question is trying to test if u know Math.max(-0.0,+0.0) function differentates between -0.0 & +0.0
i wanted to know if the below code is legal:
class test2{
static {
static int i=0;
}
public static void main(String[] args)
{
}
}
i am getting a compiler error.
thanks in advance
i think the compiler expects an 'else' statement
hi,
acc. to me the compiler will compiler about statement not reached. i tried it and it did complain. i use win98 second edition.
Could u please the 6 collection interfaces mentioned above?
Thanks
1.
class Test
{
public static void main(String[] args)
{
if (args[0].equals("open")) //1st if statement
if (args[1].equals("someone")) //2nd if statement
System.out.println("Hello!");
else System.out.println("Go away "+ args[1]);
}
}
Which of the following statements are true if the above program is run with the command line :
java Test closed
The 'else' statement corresponds to the second 'if' statement.
since the first 'if' statement evaluates to false it exits out of the method and there is no output.
in fact if the program ever executed the statement
System.out.println(args[1]); in the above case it would give a runtime error since the first argument passed at command is args[0]
2.
class TestClass
{
public static void main(String args[])
{
boolean b = false;
int i = 1;
do
{
i++ ;
} while (b = !b);
System.out.println( i );
}
}
1st time the do loop is entered into i=1 b=false
when it exits the do loop i=2; b=true;
since the while(condition) is while(true) the do loop is entered the 2nd time
2nd time do loop is entered i=2; b=true;
when it exits the do loop i=3; b=false
now the while(condition) is while(false) so it executes the next statement which is the print statement