I was hoping that someone could show me how to use the equals method to change numbers that were entered. Three numbers are entered and the user is asked if they need to change a number. This is followed by a yes or no. It says if the answer is yes to change the number, to use the equals method. This is donethree times by once changing the number, adding a number and removing a number. Please help! Thanks Ytula

Your question is somewhat unclear. But maybe I got it right. I posted code what I thought you were wanting if it's not let me know...

import java.io.*;

class NumbersandInput
{
 public static void main(String[] args) throws IOException
 {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 	String inData;
	int i;
	int i2;

	System.out.println("Please enter an integer");
	i = Integer.parseInt(br.readLine());
	i2 = i;
	System.out.println("\n Would you like to change the number?");

	inData = br.readLine();
	if (inData.equals("Yes"))
	   {
		try {
			System.out.println("\n What would you like to change it to?");
			i2 = Integer.parseInt(br.readLine());
		    }
		    catch (NumberFormatException e) {}
           }
	   else {
			System.out.println("No change was made");
		}

	System.out.println(" \n \n \n The staring value of the integer was: " + i);
	System.out.println(" The eding value of the integer was: " + i2);


 }
}
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.