Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

@ what i've done wrong in this solution according to this exercise create an aplication in Java that reads 2 numbers as input and then calculates and bills maximums minimums and average of these 4numbers ..solve this using Math methods ..please help me i'm a beginner import java.math.*; public class prove { public static void main(String[] args) { String name =args[0]; String name2=args[1]; int b=Math.max(name,name2); } }

OpenStudy (rsmith6559):

You're passing Strings to the Math.max function. The command line arguments are strings, you're assigning them to strings, and then trying to do math on them. At the least, your results will be interesting. As you're assigning the args to name and name2, convert them to ints, and make name and name2 int.

OpenStudy (anonymous):

type casting is your problem my friend

OpenStudy (anonymous):

@rsmith i want to use run cofiguraton my arguments and args cannot be resolved to a variable

OpenStudy (anonymous):

int as you said

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!