Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- //Instance variables.
- String name;
- int Age;
- //Class variables
- static String fname;
- static String lname;
- public static void main(String[] args) {
- //input and sum.
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter a number: ");
- int firstNum = sc.nextInt();
- System.out.print("Enter a number: ");
- int secondNum = sc.nextInt();
- System.out.print(firstNum + secondNum);
- //using instance variables
- // Main abc = new Main();
- // abc.Age=1;
- // //Local variables
- // String firstname = "Yusf", lastname = "Idres";
- //// System.out.println("Hello world!");
- // System.out.printf("%s %n", 1);
- // System.out.printf("%s %s", firstname, lastname);
- // System.out.print("Ada");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement