Thanks shiva for u r answer but concept of runtime is jvm checks the obj reference at runtime which class is instantiated to the obj it will be a super hierarchy i got it and thanks further
if we dont wnat a class to be subclassed or only one obj to be created go for singletone it only allows only one obj to be createdand rest of them to use that obj for examplePublic Class Singleton {&n...
Guest
Mar 22nd, 2006
Hi All,Generally Singleton Pattern is used while accessing database related objects. It provides one point access to whole java application. It makes sense to make it thread safe by use of synchronized keyword. Regards-ashruf
Pankaj Vishwani.....your code is compiling because you have prefixed the kerword void before the constructor of stud class...... hence its not a constructor anymore.... its beheaving like a method as ...
Ram
Jan 8th, 2007
Well pankaj. The deal is to make the constructor private. In your example you have created a method as private as constructor do not have any return type. So try compiling again. cheers. Ram
String s = "Hello"; means one object with value "Hello" will be created in the heap and reference variable s will refer to the object.but whenString s1 = s+"World";w...
Very tricky question.Asked me in Oracle interview for 4 years level of expHere is the answer: When JVM see the code where two three string objects has been added with + operator then it is using the S...