In this example we will show the method to overwrite an existing variable value in Java.
Source Code
package com.beginner.examples;
public class OverwriteVariable {
public static void main(String[] args) {
int i = 1;
i = 12; // overwrite an existing variable value
System.out.println(i);
}
}
Output:
12