I understand that this is probably really the main question, but I cannot understand.
Say I have this main class
public class Main{ public static void main(String[] args){ int a = 0; AddSomething.addOne(a); System.out.println("Value of a is: "+String.valueOf(a)); } }
Here is the AddSomething class and addOne() method
public class AddSomething{ public static void addOne(int a){ a++; } }
addOne method addOne not add anything
System.out.println("Value of a is: "+String.valueOf(a));
How can I make the Add update variable of class a in class Main ?
source share