santosh kothapalli

+ Follow
since Dec 27, 2005
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 santosh kothapalli

I have cleared SCWCD.Thanks for the support provided from javaranch
16 years ago
putting in simple words
use getParameter() when the request /form is submitted to the server where as getAttribute() can be used at page,sesion and application level

-if a variable is set at request level using setAttribute that can be accessed by getAttribute only in the immediate submitted page
-if a variable is set at session level using setAttribute that can be accessed by getAttribute throught the session availability
-if a variable is set at context level using setAttribute that can be accessed by getAttribute through out the application by all the users
16 years ago
submit the html page and give the action attribute as jsp page then you will get the value.Before the page is submitted you cant retrieve the value using request.getParameter()
[ January 18, 2008: Message edited by: santosh kothapalli ]
16 years ago
Hi All,
I have cleared the certicfication with 77%...
Thanks to all the Java Ranchers..

SCJP 1.4
18 years ago
Irrespective of wether you are implementing threads or not ,u need to understand that static variables are class members and not instance,so in ur
code ur making two instances of Class so each gets a member num whose initila value is u get the first output...but when u make static it is class variable and the single varibale is shared by both the instances.....the first instance has incremented num to 9 and the second instance gets the num as 9...

Salil what u should rememeber is abstrat class does not stop you from writing methods that have implementation, so private variables can be accessed by those methods.In reality it happens that only few methods are absract that need to be implemented as the way u want and not all methods.
If u declare variables as wether public,private or whatever and if u dont use them it make little sense.

i think i cleared ur doubt.

Yes thats true.
The only thing u shud remeber is being native means we are providing the alternate implementation and else is immmaterial.
Assume some thing like this if the method implementation is provided the remaining signature public static final void is legal declaration..

Correct me if i am wrong

converting 0x80000000 to devimal gives

1000 0000 0000 0000 0000 0000 0000 0000
8 0 0 0 0 0 0 0

as the most significant bit is 1 this negative number so decimail equivalent is - 2(pow)31


Originally posted by velan vel:
hai what about ans F

Which two are equivalent? (Choose Two)
A. 16>4
B. 16/2
C. 16*4
D. 16>>2
E. 16/2^2
F. 16>>>2
Answer: D, E

velan vel

The answers are D and F since both give result 4.
16>>2=(16 /2pow2)=4
16>>>2=(16 /2pow2)=4 since it is not negative
16/2^2 = 8^2 = 10

array2 is two dimensional array and cannot be referenced with one dimensional array array1 so the option is A
The simplest of answers is you cannot use the instance variables in construstors to expressions or calculations ,but only to initialize else the compiler throws an error.
Just to make it official, you can find the rule in the JLS

Originally posted by Abhinav Gogna:
Actually the output is true.

The first part of the comparison (System.out.println(args.length > 4) returns true as we have 5 values in args
1) Test
2) One
3) Two
4) Three
5) -d

for the second comparison (args[4].equals("-d")), the value is true, since args @ 4th place (counting from 0) is "-d". Although "-d" is fifth but arrays start counting from 0. Hence the && operator will return as both the conditions are "True".

Test is the name of the program and not the Argument.
Hi Velan,
The result is false
As u are use conditional operator && and the first expression args.length > 4 is evaluated to false,so it does not evaluate the second expression args[4].equals("-d").
If the first expression evaluates to true by changing to args.length==4 this evaluates to true and the second expression is evaluated which results in ArrayIndexOutOfBoundsException.

The answer is compile time error as class G and class H has no relationship
hence g instanceof H or h instaceof G results in incompatible types.

The compiler is trying to say initialize the variable f before it is passed to another constructor,it is as similar as accessing a variable without initialisation.