Advertisement
SECT19N

Chapter 1 Zoom

Oct 18th, 2023 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | Source Code | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     //Instance variables.
  5.     String name;
  6.     int Age;
  7.  
  8.     //Class variables
  9.     static String fname;
  10.     static String lname;
  11.  
  12.     public static void main(String[] args) {
  13.         //input and sum.
  14.         Scanner sc = new Scanner(System.in);
  15.         System.out.print("Enter a number: ");
  16.         int firstNum = sc.nextInt();
  17.         System.out.print("Enter a number: ");
  18.         int secondNum = sc.nextInt();
  19.         System.out.print(firstNum + secondNum);
  20.  
  21.         //using instance variables
  22. //        Main abc = new Main();
  23. //        abc.Age=1;
  24.  
  25. //        //Local variables
  26. //        String firstname = "Yusf", lastname = "Idres";
  27. ////        System.out.println("Hello world!");
  28. //        System.out.printf("%s %n", 1);
  29. //        System.out.printf("%s %s", firstname, lastname);
  30. //        System.out.print("Ada");
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement