Win a copy of Rust Web Development this week in the Other Languages forum!

santhosh sharma

Greenhorn
+ Follow
since Jan 29, 2006
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 santhosh sharma

Thanks a lot to u all,

Rajaninfy , 35 days should be sufficient .

I beleive that for this exam the final result has to do a lot with the number of mock exams u write and not on ur Java knowledge

I know people who hav had 3-4 years of Java experience and fail
the exam in their first attempt

So u can allot the last 15 days for mock exams , and try to solve atleast
30 .

Just get the basics right ,
1)Concentrate on ur weak areas
2)Divide exam into 2 passes , first pass solve only the easier ones in the next tougher
3)Mark difficult questions , u can utilize the remaining time efficiently
after the 2 passes

Best of luck ,

santhosh sharma (scjp 1.4 100%)
15 years ago
The value of i will be 40

Consider the execution of the expression ,

i=20;
i=i+i++;
i=20+20; //after substituting 20 in the xpression , i will be incremented
//now i=21
//after the execution , value 40 will be stored in i
//overwriting the value 21

hope that clears ur doubt

santhosh sharma (scjp 1.4 100%)
[ February 21, 2006: Message edited by: santhosh sharma ]
The answer is 0 , because when u reach "here"
both the Integer objects are still reachable
You can access them using the references x and y respectively

The method findOut is just assigning the local variable y in that method to
null , but the variables x and y in the constructor will still be
referring to the objects

Hence no objects are eligible

Hope that clears ur doubt

santhosh sharma (scjp 1.4 100%)
Sun Certified Programmer for Java 2: Study Guide Exam 310-035 (Certification Press S.) ~Kathy Sierra, Bert Bates

K means Kathy Sierra and B means Bert Bates.

santhosh sharma (scjp 1.4 100%)
15 years ago
Hi arthur ,
I agree with you , there is no point in allowing an interface to be declared inside another interface , but hey

please check ,

interface a
{
private interface b{}
}

is giving me a compile time error
[illegal combination of access modifiers public and private]

santhosh sharma (scjp 1.4 100%)
join( ) , wait( ) and sleep( ) send a thread to a waiting state and not a runnable state
whereas yield( ) sends a thread to a runnable state and not in
a waiting state

when you call the interrupt method on that thread , an InterruptedException
is thrown if and only if the thread is not in a runnable state

that is why methods such as join( ) , wait( ) and sleep( ) throw
an InterruptedException

On the other hand when interrupt is called on a thread which
is running or in a runnable state its "interrupt status" is set
(which can be verified using the isInterrupted method in the Thread class)

Setting the "interrupt status" does not affect the state of the
thread in any way and it contines to be in running or runnable state

Hope i hav cleared u r doubt ,

santhosh sharma (scjp 1.4 100%)
What they really mean in K&B is this ,

Forget abt where the static variable is stored ,
just remmeber that there is only one copy and there are several ways
to access it

Consider the following ,

class Static
{
static int a;
{
public static void main(String args[])
{
System.out.println(a); //prints 0
System.out.println(Static.a); //prints 0
System.out.println(new Static().a); //prints 0

///this is my favorite

Static variable =null;

System.out.println(variable.a); //prints 0 , no NullPointerException!!!

Static var1=new Static();
Static var2=new Static();
var1.a=10;
var2.a=20;

////this proves that there is only one copy

System.out.println(var1.a); //prints 20

}}

Again , there are several ways to refer to a static variable
but there is only copy

Hope i hav cleared ur doubt

santhosh sharma (scjp 1.4 100%)
hi arthur,
I dont think nested interfaces can be declared as private
Nested interfaces are implicitly abstract and public

santhosh sharma (scjp 1.4 100%)
That is the easiest and the best method
In fact I use the same method
But just make sure that neither LHS nor the RHS result in a
NullPointerException or ArrayIndexOutOfBoundsException

Good luck,
santhosh sharma (scjp 1.4 100%)
try this , this should work

public class java_arrays{
public static void main(String[] args) {
Dog[][] theDogs=new Dog[3][];
theDogs[0]=new Dog[2]; //assigning column

Dog theD=new Dog(5);

theDogs[0][1] =theD;

System.out.println(theDogs[0][1].toString());
}
}

class Dog{
int p;
Dog(int p){
this.p=p;
}
public String toString()
{
return ""+p;
}}

Good luck ,
santhosh sharma (scjp 1.4 100%)
Took the exam today , scored 100% ,

Some questions were on daemon threads , synchronized blocks
on Class objects ,etc
Thanks to all the ranchers , Marcus Green, Bert Bates ,......

Some questions were tougher than the ones in Whizlabs 1.4 .

JAVA experience : 6 months

Preparation period : 4 months , 10hrs a day

Books referred : K&B , Khalid , Exam cram , Jawroski , Complete reference ,
Philip heller

Mock exams : Whizlabs 1.4 , exams available with all the above mentioned
books


The source code for all the classes is available with jdk 1.4
[compressed file with the name src]
Refer to implementation of all the methods in java.lang.* classes
it will really help you understand most of the concepts well

Thanks and regards
santhosh sharma (scjp 1.4 100%)
15 years ago
Can u please rate the following set of mock exams versus the
real exam [scjp cx-310-035 (1.4)]

Give grades as [tougher , same , easier] v/s real exam

1) danchisholm v/s real exam
2) whizlabs v/s real exam
3) jqplus v/s real exam
4) marcus green v/s real exam
The concept of inlining is borrowed from C++ .
C++ allows methods to be declared as inline

inline int a( ){return 12+31+4*3+a+c;}

Whenever u call this method say

main( )
{
some_class variable ; //C++ doesnt use the new operator
int result=variable.a();
}

Now as the method is declared as inline the compiler will replace
the function call with the expression , something like

main( )
{
some_class variable ; //C++ doesnt use the new operator
int result=12+31+4*3+a+c;
}

//the overhead of method call is eliminated


similarly in java if a method is declared as final the
code in that method will be just copied

class a
{
final void method()
{
System.out.println("aaa");
System.out.println("bbb");
}

public static void main(String a[])
{
new a().method();
}
}


/////will be transformed into


class a
{
final void method()
{
System.out.println("aaa");
System.out.println("bbb");
}

public static void main(String a[])
{
System.out.println("aaa");
System.out.println("bbb");

}
}
Hi johnson ,
Consider the following operations ,

any_number << number_of_positions [multiplication by powers of 2]
any_number >> number_of_positions [divison by powers of 2]

2<<2 , gives u 8
8>>2 , gives u 2

Shift operators can be efficiently used to perform multiplication of a
number by powers of 2(2,4,8,....) and division by powers of 2

They are more efficient when compared with * and / operators if powers
of two are involved
Absolutely the answer is 10 ,
My point is this , if the answers format in the real exam[scjp 1.4]
was given as shown the above example , then it takes around
30 seconds to determine the answer

Only one answer is correct among the 4 choices so

a)b) can be eliminated just by looking at 2 lines
d) can be eliminated as
System.out.println(new Integer(10)); can never print 10.0

hence c should be the answer !!!
see it just takes 10 seconds , thus u can save a lot of time in the exam