Chirag Sharma

Greenhorn
+ Follow
since Jun 27, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Chirag Sharma

My Question is : What is difference b/w String Pool and Heap ??

and how they are working in case of String and normal objects??

what i want to found:
1) IS String Pool the part of Heap? // Not Sure
2) What String pool contains references, objects or values?

I think its more clear now... Please help me out.
11 years ago
Thanks Winston for reply.

But this is not exactly what that i want to know.
11 years ago
1) Objects are created on the heap and Strings are no exception. So, Strings that are part of the "String Literal Pool" still live on the heap, but they have references to them from the String Literal Pool.
as mentioned on http://www.javaranch.com/journal/200409/ScjpTipLine-StringsLiterally.html

2) But I read somewhere String Literal Pool is the part of Heap and String literal created in String Literal Pool

3) Is String Constant Pool = String Literal Pool ???

which one is correct between 1 and 2 ???

Please help me out.
11 years ago
Hi Jesper,

Yea i know that we can write this like List<String>, But actually i am asking about why a raw type List allow to add different type variable in a list while i have created the object of ArrayList<String>.

List myList = new ArrayList<String>();

myList.add("Hi");// String
myList.add(12345);//int
myList.add(123.45); // double
11 years ago
List myList = new ArrayList<String>();

myList.add("Hi");
myList.add(12345);
myList.add(123.45);

System.out.println(myList);

I am little confuse with that, why this list can add all type of values, while we have defined that arraylist will contain only String.

11 years ago
Hi Satnam,

I have faced this issue and it resolved i have done the following:

web.xml:
<servlet>
<display-name>ProfileDetails</display-name>
<servlet-name>ProfileDetails</servlet-name>
<servlet-class>com.user.ProfileDetails</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProfileDetails</servlet-name>
<url-pattern>/ProfileDetails.xyz</url-pattern>
</servlet-mapping>


struts.xml:

<constant name="struts.action.excludePattern" value="/ProfileDetails"/>



jsp:


<form name = "myForm" method="post" action="ProfileDetails">

I think it will be helpfull.

11 years ago
In a interface we can also use equals and other methods?
11 years ago
Hi Sanaulla,

Thanks for reply.
I want to ask that .. according to my example...
... class A extends Object class
... class B extends Object class
... and B also extends A

So its looks like a multiple inheritence...
....i think its clear now.
11 years ago
Every Java Class Extends Object class.

Lets discuss with an example:
1)
class A {//default extends Object
}

2)
class B extends A {//default extends Object
}

why we are not getting problem (ambiguity problem named in C) here?
11 years ago
1) Why does not Http support other protocol, even it is also extend generic servlet?
............
2) What we can do to support other protocol, if we extend generic servlet?
11 years ago
HI Bhooopendra,

I am using your last suggestion.

Thanks to all to reply.
Why do you need to assign these numbers in the way you've described?


Hi martin;

actually this String Id is used when we view the record. We show String Id in place of Pk Id.
Hi Bill,

can i auto Increment the string id?
Thanks Bill for reply....

I have checked that link. He is using Sequence with annotation.

I am using MySql database. and using hbm.xml files i hibernate 3.0

Ok ... I am going to tell..for wat i am looking for:
.....................................................................................................
we are saving a record using <generator> increment </generator>
.... we want to save another column of this record like "REQ"+[max(pkId)+1]
...........................

It creates problem in multithreaded environment.
Don't wanna use Synchrinized as lot of users are there.