Yes there is a difference. In case of str = "abc" we are creating an anonymous object and assigning it the reference str. But in case of str = new String("abc"), we are actua...
class A {..String s1="abc";String s2=new String "abc";..}The first line creates (sort of, see below) the String "abc" in the String pool, and s1 points to it. The second ...
Get the date from request and use simpleDateFormat. e.g.String str = "2006-01-01";//you can have a different pattern like MM/DD/YYYY SimpleDateFormat sdf = ne...
Singleton ensures that you have only one object of a particular class per JVM. It is used when you need to refer to same object in say different instances of other classes. e.g. in a servlet, each tim...
Kavitha
May 22nd, 2006
The best use is, In most of the pooling(Connection Pool) we use singleton to access the connection