Exercise 1: Write a simple java program to take user input of a number and store it inside an integer variable. Later print the number on the screen. Solution 1: import java.util.Scanner; public class UserInpur { public static void main(String[] args ) { Scanner sc = new Scanner(System. in ); System. out .println( "Enter a number" ); int x = sc .nextInt(); System. out .println( "You have entered:" ); System. out .println( x ); } } Exercise 2: Write a simple java program to tak...
Learn Java Dot Com - is a complete and comprehensive guide on Java programming with example.