Shailesh Vohra

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

Recent posts by Shailesh Vohra

i did not understand your explanation Anbarasu Aladiyan.
Can one explain again...?
I just have to make my Objects also final....How to achieve it.?
Hi all,

If references are marked final,

final Object o1 = new Object();
Object o2 = new Object();

we cant do this,

o1 = o2; //This is wrong.

but surely we can change the state of o1 (i.e change the value of instance variables for o1).


Now suppose i want to restrict even changing the state of the object o1.

How can we achieve this..??

Any help is appreciated.



Hi Promila,


class Car knows about (extends) class Vehicle and it also knows about interface Colorable(implements).

So instance of Car can be typecast to any of its upper level class or interface as done in first case.

But class Vehicle has no idea about interface Colorable. Hence its instance cant be typecast to Colorable.

In terms of JVM, it asks what is Colorable.???

Please correct me if i am wrong...

thanks nidhi.
i will surely go through the Regex in more details.
thanks Larry and Henry for that explanation.
Also do "|" also have special meaning in regex??
because i need to use String.split("\\|").
thanks Larry.
But i want to use "$$" as a delimiter and not "$".
and i am passing it correctly (hope so). as String.split("$$")
Please explain why its not printing desired output.
I am running below code :

String s3 = "ABC$$DEF$$P QR$$XYZ";
String []s2 = s3.split("$$");

for (int i = 0; i < s2.length; i++) {
System.out.println(s2[i]);
}

Here i am using regex : "$$" as a delimiter.
but output i am getting is same as inp String. i.e ABC$$DEF$$P QR$$XYZ

But this is not my desired output.
i want output as
ABC
DEF
P QR
XYZ.

Please help to explain me. also when i use delimiter "|" why do i have to use escape sequence.
String.split("\\|").


How do we decide when we shud use Abstract Class and we shud use Interface .???
Can one explain wid example.?
14 years ago
Marker Interface do not contain any method declaration as per definition e.g java.io.Serializable and Cloneable or they are blank Interface.
Then WHY do require them.??