Integer objects are immutable, so you cannot modify the value once they have been created. You will need to create a new Integer and replace the existing one.

playerID = new Integer(playerID.intValue() + 1);
Answer from Grodriguez on Stack Overflow
๐ŸŒ
Programiz
programiz.com โ€บ java-programming โ€บ examples โ€บ add-numbers
Java Program to Add Two Integers
class Main { public static void main(String[] args) { int first = 10; int second = 20; // add two numbers int sum = first + second; System.out.println(first + " + " + second + " = " + sum); } } ... In this program, two integers 10 and 20 are stored in integer variables first and second respectively.
Discussions

Java Integer addition - Stack Overflow
For clarification, this integer could be anything, just has to be 5 digits. ... You need modulus (%) operator. Google it. ... Exactly why you need it. ... If you do a modulus of a number with 10, you will get the last digit as remainder. Makes sense. ... From the top of my head, you can convert it to string and iterate over each char, accumulating the value with ( charAt( position ) - '0' ). I'm away from a java ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
java - Adding integers to an int array - Stack Overflow
Each bucket contains 1 integer. To begin with these will all be 0. ... The two lines above set the first and second values of the array to 1 and 2. Now your array looks like this: ... As you can see you set values in it, you don't add them to the end. If you want to be able to create a list of numbers which you add to, you should use ArrayList. ... Save this answer. ... Show activity on this post. You cannot use the add method on an array in Java... More on stackoverflow.com
๐ŸŒ stackoverflow.com
java - Operation inside when we add two Integer objects? - Stack Overflow
Can some one explain me how the internal behavior when we add two Integer objects in java? (like it is unbox Object into primitives and then add two integers and finally boxed it in to Integer obje... More on stackoverflow.com
๐ŸŒ stackoverflow.com
The method add(Integer) in the type ArrayList<Integer> is not applicable for the arguments (ArrayList<Integer>)
Have you tried to use List instead of ArrayList in the method definition ? Like this List add(List value2) Make sure the argument and the ListIntegers have the same number of element, otherwise you might end up with OutOfBoundException. Recommendation: variable names should begin with low letter unless it is a constant. Try to name your argument something meaningful More on reddit.com
๐ŸŒ r/learnjava
16
2
February 23, 2019
๐ŸŒ
Alvin Alexander
alvinalexander.com โ€บ blog โ€บ post โ€บ java โ€บ add-two-integers
Java int - How do I add two integers? | alvinalexander.com
June 4, 2016 - Answer: Just use the Java addition operator, the plus sign (+), to add two integers together.
๐ŸŒ
Oracle
docs.oracle.com โ€บ javase โ€บ 8 โ€บ docs โ€บ api โ€บ java โ€บ lang โ€บ Integer.html
Integer (Java Platform SE 8 )
April 21, 2026 - Adds two integers together as per the + operator. ... Returns the greater of two int values as if by calling Math.max. ... Returns the smaller of two int values as if by calling Math.min. ... Javaโ„ข Platform Standard Ed.
๐ŸŒ
TutorialKart
tutorialkart.com โ€บ java โ€บ java-program-add-two-integers
Java Program - Add Two Integers
November 23, 2020 - Coming to first example, we shall take two hard coded integers and find their sum using arithmetic addition operator. In the second example, we shall read two integers from console which shall be entered by user, and find their sum. In this example, we shall take two integers and find their sum using arithmetic operator. ... /** * Java Program - Add Two Integers */ public class AddTwoIntegers { public static void main(String[] args) { //two numbers int num1 = 10; int num2 = 25; int sum; //add two numbers sum = num1 + num2; //print the sum System.out.println(sum); } }
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ integer-sum-method-in-java
Integer sum() Method in Java - GeeksforGeeks
January 21, 2026 - The method internally performs integer addition similar to: return a + b; Being a static method, it can be called directly using the Integer class. ... class GFG { public static void main(String[] args) { int a = 92374612162; int b = 181; ...
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_howto_add_two_numbers.asp
Java How To Add Two Numbers
Learn how to add two numbers in Java: int x = 5; int y = 6; int sum = x + y; System.out.println(sum); // Print the sum of x + y Try it Yourself ยป ยท Explanation: We create two integer variables (x and y) and assign them values.
Find elsewhere
๐ŸŒ
Javatpoint
javatpoint.com โ€บ java-integer-sum-method
Java Integer sum() Method - Javatpoint
Java Integer sum() Method - The sum() method of Java Integer class numerically returns the sum of its arguments specified by a user. This method adds two integers together as per the + operator. It can be overloaded and accepts the arguments in int, double, float and long.
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ java โ€บ examples โ€บ add-two-integers
Java Program to Add Two Integers | Vultr Docs
December 4, 2024 - This code snippet initializes two integers, num1 and num2, with the values 5 and 10, respectively. It then calculates the sum of these two numbers and stores the result in the variable sum. Finally, it prints out the result. Import the Scanner class for taking input from the user. Prompt the user to enter two numbers. Read the entered values using the Scanner object. Compute the sum and display it. ... import java.util.Scanner; public class AddIntegersUserInput { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter first integer:"); int firstInteger = scanner.nextInt(); System.out.println("Enter second integer:"); int secondInteger = scanner.nextInt(); int sum = firstInteger + secondInteger; System.out.println("The sum of " + firstInteger + " and " + secondInteger + " is " + sum); scanner.close(); } } Explain Code
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ java-how-to-perform-large-integer-addition-in-java-414107
How to perform large integer addition in Java | LabEx
Adding large integers in Java using the BigInteger class is generally efficient, as the class is designed to handle the underlying complexity of large number arithmetic.
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ java โ€บ add integer to array java
How to Add Integers to an Array in Java | Delft Stack
February 2, 2024 - The add() function appends each integer to the end of the array. In this way, we build our array dynamically without the need to specify its size beforehand. This is an efficient way to manage arrays in Java, especially when the size of the ...
๐ŸŒ
Coderanch
coderanch.com โ€บ t โ€บ 723518 โ€บ java โ€บ Adding-integer-Integer
Adding the same integer at the End of the Integer (Java in General forum at Coderanch)
For example I have my int 11 and want to add 3 digits to 11 from the same int like: 11111. Second example 10 with 6 more digits: 10101010 So I always need to add the value I have at the end a certain amount of times. Thought about making an array and entering the numbers but the result needs to be an int to.
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2017 โ€บ 09 โ€บ java-program-to-add-two-numbers
Java Program to Add two Numbers
February 20, 2026 - import java.util.Scanner; public class AddTwoNumbers2 { public static void main(String[] args) { int num1, num2, sum; Scanner sc = new Scanner(System.in); System.out.println("Enter First Number: "); num1 = sc.nextInt(); System.out.println("Enter Second Number: "); num2 = sc.nextInt(); sc.close(); sum = num1 + num2; System.out.println("Sum of these numbers: "+sum); } }
๐ŸŒ
Reddit
reddit.com โ€บ r/learnjava โ€บ the method add(integer) in the type arraylist is not applicable for the arguments (arraylist)
r/learnjava on Reddit: The method add(Integer) in the type ArrayList<Integer> is not applicable for the arguments (ArrayList<Integer>)
February 23, 2019 -
ListIntegers = [1,2,3,4,5,6,7]
value2 = [1,2,3,4,5,6,7]
ArrayList<Integer> total = new ArrayList<>();

I'm trying to invoke the method "add" that I have by using this: total = ListIntegers.add(value2);

private ArrayList<Integer> add(ArrayList<Integer> value2) {
	      
	   ArrayList<Integer> totalAdd = new ArrayList<Integer>();
	      
	 for (int i = 0; i < ListIntegers.size(); i++) {
	   //for (int i = ListIntegers.size()-1; i >= 0; i--) {
		 totalAdd.add(ListIntegers.get(i) + value2.get(i));
	 }
	   Collections.reverse(totalAdd);
	      
	 //array to number
	   int ans =0;
	   for (int i = 0; i <= totalAdd.size()-1; i++) {
		  ans += totalAdd.get(i);
	      ans *= 10;
	   }
	   ans /= 10;
	   System.out.println(ans);
	   
	return totalAdd;
   }

However, I got the complaint "The method add(Integer) in the type ArrayList<Integer> is not applicable for the arguments (ArrayList<Integer>)"

Any suggestions? Please go easy on me. I'm learning too.

EDIT:

The entire project

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class BigInt {

	// variables
   private boolean isPositive=true;
   private ArrayList<Integer> ListIntegers = new ArrayList<Integer>();
	
	// Consider a String argument to the constructor
   public BigInt(String BigIntInput) {
      storeStringAsIntegers(setSignAndRemoveItIfItIsThere(BigIntInput));
   }

	//Consider an integer argument to the constructor
   public BigInt(int BigIntInput) {
      storeStringAsIntegers(setSignAndRemoveItIfItIsThere(String.valueOf(BigIntInput)));
   }
	
	//Consider a BigInt argument to the constructor
   public BigInt(BigInt BigIntInput) {		
      storeStringAsIntegers(setSignAndRemoveItIfItIsThere(BigIntInput.toString()));
   }
	
	// Default constructor
   public BigInt() {
   	
   }
	
	/** 
	 * This method removes the + or - sign if it's the first character of the string, 
	 * and end the program if it's the only character in the string.
	 */
   public String setSignAndRemoveItIfItIsThere(String input) {
      String inputString=input;
      if(inputString.length() >= 1) {
         if (inputString.charAt(0) == '+' || inputString.charAt(0) == '-') {// if the first character is a sign, delete the sign
            if(inputString.charAt(0) == '-')
               isPositive=false;
            inputString = inputString.substring(1);
         }
      } else {
         throw new InputErrorException("Bad String Input");
      }
      System.out.println("Set Sign and Remove If It Is There: " + inputString);
      return inputString;
   }
	
	/**
	 * This method will work through the string from the end to the front and store the 
	 * string as integers.
	 * If a character other than a digit is encountered end the program.
	 */
   public void storeStringAsIntegers(String input) {
      String inputString=input;
      //for(int i = inputString.length()-1; i >= 0; i--) {
      for(int i = 0; i <= inputString.length()-1; i++) {
         if(inputString.charAt(i) >= '0' && inputString.charAt(i) <= '9') {
         	//StringToIntegers = Integer.parseInt(inputString); // Converting the String (inputString) to the primitive type int (StringToIntegers) 
         	
         	//StringToIntegers = StringToIntegers * 10 + (StringToIntegers % 10) ;
         	//StringToIntegers = StringToIntegers / 10;
            ListIntegers.add((inputString.charAt(i) - '0')*1);
         	//StringToIntegers += (inputString.charAt(i) - '0') * factor;
         	//factor *= 10;
         	
         } else {
            throw new InputErrorException("Bad String Input: a character other than a digit is encountered");
         } 
      }
   }
	
	/** 
	 * The toString() method creates and returns a String with the sign if it is negative 
	 * and then adding the ArrayList integers starting from the back of the list to the 
	 * front.
	 * */
   public String toString() {
      String value = "";
      if(isPositive == false)
      	//value=String.join(value, "-");
         value = value + "-";
   
    //for(int i=ListIntegers.size()-1;i>=0;i--) {
      for(int i = 0; i <= ListIntegers.size()-1; i++) {
      	//System.out.println(ListIntegers.get(i));
      	//value=String.join(value, String.valueOf(ListIntegers.get(i)));
         value = value + String.valueOf(ListIntegers.get(i));
      }
      return value;
   }
	
	//*************************************************************************************
	//*************************************************************************************
	
	/**
	 * This method will look through the sign of the input values. 
	 * If both values have the same signs, invoke method add().
	 * If both values have different sings, invoke method subtract() and set sign to that of larger value.
	 */
   public BigInt add(BigInt objValue2) {
   	// 3. https://www.geeksforgeeks.org/add-two-numbers-represented-by-two-arrays/
   
   	// use to store the total before converting it into BigInt b3
	   ArrayList<Integer> total = new ArrayList<>();
	   
   	// object b3 to store the answer
      BigInt b3= new BigInt();
   	
      System.out.println();
      System.out.println("ListIntegers1: ---> " + ListIntegers);
      System.out.println("ListIntegers2: ---> " + objValue2);
      
      ArrayList<Integer> value2 = new ArrayList<Integer>();
      
      // converting objValue2 to String str
      String str = objValue2.toString();
      System.out.println("String str: ---> " + str);
      
     
      for (int i = 0; i < str.length(); i++) {		  
        value2.add((str.charAt(i) - 48 ) * 1);
      }
      value2.remove(0);
      System.out.println("ArrayList value2: ---> " + value2);
      
      // Consider the sign and determine whether to use addition or subtraction
      // Same signs -> add
      // Different sings -> subtract
      if((ListIntegers.get(0) == '+' && ListIntegers.get(0) == '+') || (ListIntegers.get(0) == '-' && ListIntegers.get(0) == '-')) {
    	 //total = ListIntegers.add(value2);
      } else {
    	 //total = ListIntegers.subtract(value2);
      }
      
      return b3;
   }
	
	/**
	 * This method will do the actual calculations; adding
	 */
   private ArrayList<Integer> add(ArrayList<Integer> value2) {

	   ArrayList<Integer> totalAdd = new ArrayList<Integer>();
	      
	   for (int i = 0; i < ListIntegers.size(); i++) {
	   //for (int i = ListIntegers.size()-1; i >= 0; i--) {
		   totalAdd.add(ListIntegers.get(i) + value2.get(i));
	   }
	   Collections.reverse(totalAdd);
	      
	   //array to number
	   int ans =0;
	   for (int i = 0; i <= totalAdd.size()-1; i++) {
		  ans += totalAdd.get(i);
	      ans *= 10;
	   }
	   ans /= 10;
	   System.out.println(ans);
	   
	return totalAdd;
   }
   
   private ArrayList<Integer> subtract(ArrayList<Integer> value2) {
	   ArrayList<Integer> ans = new ArrayList<Integer>();
	return ans;
   }
}

Demo:

public class DriverClass
{
    public static void main(String[] args)
    {
    	BigInt value1 = new BigInt(1234567);
    	BigInt value2 = new BigInt(-1234567);
    	BigInt value3 = new BigInt(-0);
 
    	BigInt b3;
    	b3 = value1.add(value2);
    	
    	System.out.println("Sum b3 is " + value1 +" + " + value2 + " = " + b3);
    	
    }
}

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ java-program-to-add-two-numbers
Java Program to Add Two Numbers - GeeksforGeeks
January 21, 2026 - The most straightforward way to add two numbers in Java is by using the + operator. ... public class Main { public static void main(String[] args) { int a = 10; int b = 20; int sum = a + b; System.out.println("Sum = " + sum); } } ... Explanation: ...
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ java โ€บ math โ€บ biginteger_add.htm
Java.math.BigInteger.add() Method
The following example shows the usage of math.BigInteger.add() method. package com.tutorialspoint; import java.math.*; public class BigIntegerDemo { public static void main(String[] args) { // create 3 BigInteger objects BigInteger bi1, bi2, ...