Shelly Biswal

Greenhorn
+ Follow
since Sep 07, 2007
Merit badge: grant badges
For More
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 Shelly Biswal

Thanks Campbell, your post helped me
14 years ago
Hi,

I have the following

1) a list of strings. These strings are related to each other as parent and children.
For e.g, if my list contains a,b,c,d, then a is parent of c and b, c is parent of d.
each child can have only one parent.

I need to write logic to pass this list in an iterator and keep finding the parents till the root(in e.g. it is a) and in each iteration i need to check for an attribute of the parent(by passing parent in some xyz method).

Please let me know how i could implement this logic.

Hoping for a response soon.

Regards,
Shelly
14 years ago
Hi All,

i need to split the following string : "//name['firstname = shelly']"
and get output as : firstname
shelly
and then i need to put them in string variables like
nameCategory = firstname and
myName =shelly
how do i do it?
do i need to use multiple split statements?
15 years ago
I wrote the code everyting wrks fine except line /*1*/ - the output is always null dont know why.. pls explain



ReadCharacterMapping.java

16 years ago
Hi all,
i urgently need help....

i need to write a program which will encrypt a string using a character mapping provided in a file.
The input to your program will be a file which contains mapping for characters.
For E.g. A D
B R
S H
with this mapping if the string has an 'A' then it should be replaced by 'D' etc...
I have to use java exception handling to handle any exceptions like "File not found","File format not correct", "No mapping Present" etc....
16 years ago
Thanks guys n thanks to david.
my problem is solved.
i guess thats what interfaces are for !
16 years ago

The only possibility i can see in your problem is that..

you want to pass x instance to both abc(A a) and xyz(B b), Just tell me How two different reference type (a and b) can accept X Object..The only one possible way is they must have to be in same hirerachy...!! so as per my knowledge the only solution is let B inherits A..and X inherits B..!!!



The problem above is my methods are in different frameworks, as in, not in the same heirarchy.They are two different classes from any location but they are not aware of each other.
If B inherits from A then B compulsorily will have all the methods from A which is not desired here.
16 years ago
Hi All,

My question is how to use polymorphism to solve the problem described.

I have two Frameworkd Fr1 and Fr2.

Fr1 has a class with method abc(A a) which takes an instance of some class A
Fr2 has a class with method xyz(B b) which takes an instance of some class B

I have a Class where i am instantiating an instance of Some Class X.
X x = new X();
now i want to pass the above instance x to both the methods abc() and xyz() in two different framewroks.
how would i do that using polymorphism?
I understand that i can make Class X extend from A or B and pass x instance but we cant extend from more than one class.
So how do i solve the above?
16 years ago
Yes there was another class named Animal in another java class called o.java.
i dnt understnd why that should affect my class animal in another java class.
cant i ve same class names in two different java files???
16 years ago
I have a java class called TestHippo.
While compiling i get the following error:
D:\shell\Personal\Tech\Java\TestHippo.java:1: duplicate class: Animal
class Animal {
^
1 error


Following is the code:

16 years ago
Hi all,

i compiled the following code and it compiled but gave me a run time exception followed by the code



ERROR

Inside O
I am a Dog
Add Animal
Added Animal
Exception in thread "main" java.lang.ClassCastException
at o.main(o.java:29)

Questions
1) Why did it compile in the first place?
2) At runtime why Cast Exception, i am extending from Dog and casting o to it
3) if i change O = (o)dog to O = dog , it throws compile time error as follows :
found : Dog
required: o
O = dog;
^
1 error

Why so???
16 years ago
hi was just wondering what does java -cp exactly do and what parameters does it take???
16 years ago
hi was just wondering what does java -cp exactly do and what parameters does it take???
16 years ago
Thanks a lot Dharmendra and Prahald...
excuse my silly mistake am just starting out!!!