Hi guys

Please i need help ?

Maxint: Write a program that gets two
integers from the user and prints out the
maximum value in a nice sentence beginning
“The max is: “

public class Maxint  {
	public static void main (String [] args) {
	
	System.out.println("Enter two integers");
	
	double Max = Math.Max;
	double Max = Math.Max;
		
	Max = a;
	Max = b;
	
	
		System.out.println("The max is:" + Math.Max(a,b));
	}
}

Recommended Answers

All 9 Replies

Perhaps you should actually ask a question.

Perhaps you should actually ask a question.

i don't what to do
Plz help me to get this right

Well, you should probably start by referring to your class notes on how to get a value from the user.

Well, you should probably start by referring to your class notes on how to get a value from the user.

ok plz explain to me how to get a value from the user !

If you don't have any notes from class on how to do it, then look up the Scanner class in the Java API docs.

If you don't have any notes from class on how to do it, then look up the Scanner class in the Java API docs.

not helping,anyway thanks

also, taking a look at java syntax and 'stuff' might help you out figuring out why your code won't compile.

1. don't declare two times the same variable
2. don't use the values a or b unless you actually have variables a and b with a value.

WHY DID YOU NAME TWO VARIABLES WITH THE SAME NAME?

double Max = Math.Max;
	double Max = Math.Max;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.