How to increase number in string by 1 with Java

1 Answer

0 votes
public class MyClass
{
	public static void main(String[] args)
	{
		String str = "234";

		str = Integer.toString(Integer.parseInt(str) + 1);

		System.out.print(str);
	}
}




/*
run:
 
235
 
*/




 



answered Aug 31, 2023 by avibootz

Related questions

1 answer 94 views
1 answer 87 views
1 answer 108 views
2 answers 185 views
185 views asked Jun 11, 2020 by avibootz
...