0

Is there anyone who knows the answer ? Scanner file can not be using !

https://code.sololearn.com/cZT19Gfwb1fv/?ref=app

24th Nov 2019, 3:04 PM
Bekir Safa Yesil
Bekir Safa Yesil - avatar
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.
24th Nov 2019, 3:11 PM
Avinesh
Avinesh - avatar
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 ..."!
24th Nov 2019, 4:17 PM
Bekir Safa Yesil
Bekir Safa Yesil - avatar
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.
24th Nov 2019, 4:24 PM
Avinesh
Avinesh - avatar
0
I just want to choose the first and second warriors after runing program.
24th Nov 2019, 4:28 PM
Bekir Safa Yesil
Bekir Safa Yesil - avatar
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.
24th Nov 2019, 4:34 PM
Avinesh
Avinesh - avatar