Write a console program with static method inc that takes va
Write a console program with static method inc() that takes value of type int and returns that value increased by one. In main() method do the following: Ask a user to enter an integer value Call method inc() and pass user input (integer value) into that method Print returned result
Solution
import java.util.*;
import java.lang.*;
import java.io.*;
class Program {
public static void main(String[] args) {
int a;
Scanner in = new Scanner(System.in);
System.out.println(\"Enter an integer\");
a = in.nextInt();
inc(a);
}
static void inc(int value) {
System.out.println(value++);
}
}
