Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

kamal jaisingh

Ranch Hand
+ Follow
since Feb 23, 2001
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 kamal jaisingh

i suggest u start with JAVA2 the complete reference
thts the best book for starting with basicjava concepts .
and wht about only
static void main(String args[])
protected static void main(String args[])
if asked in the exam if these r correct ways to define
the main() method then can v say 'yes' , these r valid ways or
someone pls be more specific???
and wht about final public static void main(String args[])
ya there is somethin abt 2 privacy questions to be asked
in scjp exam .
even i want to know abt it .
can anyone whos given scjp throw some light on this???
when u use setBounds(), it will not work cause a layout manager
will cover the effect .
in order to use setBounds succesfully , 1st set layout of the frame to null
then u can use setBounds which will work for sure.
hope this helps
Kamal J
thx a lot for ur prompt reply
i got it
i read in velmurugan notes abt arrays ,
tht when an array of 5 Strings is created , total 6 objects
r created.
i am a little confused on this point.
is it tht 5 String objects and 1 array object is created , ie
6 objects???
can anyone xplain is this right , or theres somthin else to

the value of b is not changed cause u r passing copy of a variable b.
and b is of primitive datatype , so the changes taken place to b inside the method does not affect the value of b outside the method since only copy of b is sent and not b itself.
as for c changing, in this case also copy of c is sent to the method, but since c is an array , tht nmeans its an object, so the value of c changes , java works with references and not directly with objects.

rule , when u pass an object as an argument , u can change the value, ie, reference of tht object in method body ,
when u pass primitive type, no changes r made.
u can make changes to a variable only if u pass an object .
in ur case c is an object ..
hope this helps
can anyone throw any light on the above question.
finally why the answer should be b ,
i understood it cannot be 'a'n bcause same button is used
and no new button is created.
but why button will be displayed in north and not any other
part of the applet (south , east , west)
can anyone xplain the above
as far as my knowledge goes, a non static inner class
declared in a class can have access to all member variables
of its enclosing class.
but an inner class defined in a METHOD can have access to
only final variables of the method , and this inner class inside a method can freely access outer class variables , but can access only final variables of the method inside which it is defined.

rule is
inner class inside a class ::: free access to all member variables of the class.

inner class inside a method: access to only final variables
of the method
anyone pls correct me if i am wrong.
Kamal J
thx hima
now i get it much clearly.
can u also tell me wht r the other unchecked exceptions
just like ArithmeticExcpetion is an unchecked Exception

Kamal J
thx a lot for ur replies
now its clear to me abt string and object references.
thx again
Kamal J
regardin overidding.
class drum
void method2(int j)
public class vote extends drum
void method2(final int j)throws ArithmeticException


this code does not give compile error.
but how can a method in vote class throw an exception if the
method in drum class does not throw it also.
but if i just give throws Exception instead of ArithmeticException
it gives error as expected.
rules for ovrriding r , u cannot define the new method to throw
exceptions unless it is defined in the original method right???
so in thiscase there is no exception in method in drum class
but there is one in vote class ,
how is tht possible ??
ragardin strings:

class s11
public static void main(String[] args)

String s11 = new String("H");
String s12 = s11;


the output is true.
shldnt it be false.
s11 creates a new string object with new.
and s12 is assigned s11.
but s12 is in the string pool and s11 is a new string
so how does this result true using ==.
pls clear this
accordin to khalids book , in chp 2 Q2.5 it says
which r valid declarations ??
select all valid answers..
a. char a='\u0081';
b. char \u0061='a';
c. ch\u0061r='a';
it says all answers r valid.
i understood the a answer
can u declare a char variable like in b and c options above.
i thgt variable names could not contain \.
pls throw some light on this .
rules for short circuit
short s;
int i;
s+=i // is allowed , int is automatically converted to short
no casting required here.
but s= s+i // illegal , cause this expression will result in an int value , so it has to be expiliclty casted to short.
s= (short) s+i;//now legal,
as stated above s+=i does not require casting.
hope this helps..

Kamal J