0
Is there anyone who knows the answer ? Scanner file can not be using !
5 Answers
0
See String a and b are not objects of the Warriors class, they are just going to hold string constants.
So if you are trying to invoke the fight method then you need to use john, michael or sofia. Or else just pass the string a and b as it is instead of saying a.name or b.name.
0
Avinesh, yes i know a and b are not objects of warriors. But they are Scanner file. I used this way to choose warriors at the Scanner tool. So if i write "john sofia" after program works the program should understand like "john.name , john.life, john ,attackpower, sofia.name, sofia.life, sofia.attackpower." But it still understand like; "a.name, a.life ..."!
0
Bekir Safa Yesil I'm sorry, I didn't thought it the way you just mentioned. By the way what are you exactly looking for.
0
I just want to choose the first and second warriors after runing program.
0
Bekir Safa Yesil apparently your a.name and a.life does not work but if you replace it with a warriors object then it is working completely fine.