shashank hiwarkar1

Greenhorn
+ Follow
since Feb 11, 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 shashank hiwarkar1

Gaurav,

I doubt,
The session variables are stored on client side.
If u use jsp instead of ur HTML page then these variables can be stored. But with html i think u can not retrieve those session variables in Html

If anybody is having the other ideas then let me know
Shashank
shashank_hiwarkar@hotmail.com
20 years ago
Correct me if I ma wrong........
Unna,

if u r using www.vsnl.com
then they are having their own mail host. You need to use that smtp host.
Now when you post anything@yahoo.com,
it will connect to the smtp host you specified.
That smtp host will connect to the gateway of the vsnl,through the routers.
Now ur request is at the gateway, this will distribute ur request depending on the address u specified, ie yahoo.
That means at the time of coading ur mail client u need to specify only ur smtp host.

Shashank
20 years ago

Originally posted by Chris Ben:
Here are the codes and output. Can anyone explain to me what is going on?
Thanks
String s1="ab";
String s2="abcd";
String s3="cd";
String s4=s1+s3;
s1=s4;
String s5="abcd";
System.out.println("s1"+((s1==s2)?"==":"!=")+"s2");//s1!=s2
System.out.println("s2"+((s4==s2)?"==":"!=")+"s4");//s4!=s2
System.out.println("s1"+((s1==s5)?"==":"!=")+"s5");//s2!=s5
System.out.println("s2"+((s2==s5)?"==":"!=")+"s5");//s2==s5
System.out.print("s4"+((s4==s5)?"==":"!=")+"s5");//s4!=s5



The objects stored in the memory at heap or at the constant pool.
In your example s1,s2,s3,s5 are stored in the constant pool initially
While with s4=s1+s3 will create same string but will be stored in the heap (runtime).
with s1=s4, again runtime s1 will get abcd and stored in heap.
Now we have s2=abcd
s3=cd
s5=abcd stored in pool
And
s1=abcd
s4=abcd
stored in the heap.
now
1.s1==s2 points two references,
2.s4==s2 same
3.s1==s5 same
4.s2==s5 points one object in a pool
5.s4==s5 same as 1,2,3

Shashank
Can String literals ever be garbage Collected?

eg
String s1="abc";
String s2="aaa";
s1=null;
s2=null;
When will be s1,s2 be garbage collected?
Why?

Anonymous Inner classes cannot implement an interface and extend a non-final class at the same time.

can anyone explain me why?
(From Abhilash Exam)
Hi Lisa,
Try this........
public class shift{
int i;
public static void main(String sha[]){
shift s=new shift();
s.cal();
}
public void cal(){
int i=0;
i++;
i++;
System.out.println(i);
}
}

What will be the output?
1.0--------------As per ur assignment and increment prescedence .
2.2-------------Actual observed.
Can any body throw some more light on this

Shashank
Hi Jing,

Here u r using layout as GridLayout(),
Gridlayout has constructor as "gridlayout(x,y)"
here x=no. of rows
y = no. of columns
but if you are not passing any arguments to the constructor, it will treat as (1,n)
ie number of components added will be arranged in one row from left to right

Shashank
Hi Yogesh,
I am working with jkd1.3, and it works without any error.
Probably(I am not sure) it is taking null as default value of String object and doing toString() for true.
I may Be wrong, Can Anybody throw some more light on this.
Shashank
Hi Deepa,

true,null & false are not the keyword but these are reserved literals.
Shashank
Hi Swati,
Your questions are well answered above,
only thing I would like to add thatthe overridding method can not throw more checked exception than superclass method, but it can throw more runtime exceptions(Unchecked Exception) than superclass method.
eg. ArithmaticException,NullPointerException etc.

Shashank
hi Pankaj,

You are not doing any arithmatic operation there .
+ is the overloaded operator for string concatanation.
Shashank
hi mansoor,
try this

public class shift{
public static void main(String args[]) {
System.out.println(true+null);
}
}
o/p is truenull.
shashank
Hi Wasim,
You are Correct, Code will not give any error, with o/p as 6

shashank
hi mansoor,
+ operator is overloaded for string concatanation.
this produces result as one string followed by other.
But for that one should be string object, and then other if not string is converted as string object.
Let us consider
System.out.println(2+3);
it gives 5; and not 23
because out of two none is string object.
Now consider
System.out.println("true" +2 + 3);
o/p true 23
because 2 and 3 are converted as string object.
Now with
System.out.println(true+null)
where true/false and null(default value of String object) are reserved literals of java, (they are not primtive datatypes)
IT will NOT give the compilation error
but give o/p as truenull.
as null is default value of String literal'
with Syste.out.println("true"+null)
"true" is string and hence the other literal is converted as string and o/p truenull.

If I am wrong with my concepts I will welcome any suggestions.
shashank
Hi Thomas,
Let us say I am making my applet trusted, then with this applet how can I connect ot the database, can u explain plz?
shashank