SHARE
TWEET

UML FAF1

Sunjaree Nov 9th, 2019 (edited) 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main {
  2.     public static void main(String[] args) {
  3.  
  4.         T t = new T();
  5.         swap(t);
  6.         System.out.println("e1 = " + t.e1 + " e2 = " + t.e2);
  7.     }
  8.     public static void swap(T f){
  9.         int temp;
  10.         temp=f.e1;
  11.         f.e1=f.e2;
  12.         f.e2=temp;
  13.     }
  14. }
  15.  
  16. class T{
  17.     int e1 = 1;
  18.     int e2 = 2;
  19. }
  20.  
  21. ********************************************************************************************************************
  22.  
  23. import java.util.ArrayList;
  24. class StudentList{
  25.     String name;
  26.     String major;
  27.     int Id;
  28.  
  29.     StudentList(String name,int Id,String major){
  30.         this.name = name;
  31.         this.major = major;
  32.         this.Id = Id;
  33.     }
  34. }
  35. public class StudentList_Oop {
  36.     public static void main(String[] args){
  37.  
  38.         StudentList student1 = new StudentList("Sunjare",191,"ECE");
  39.         StudentList student2 = new StudentList("Sasc",192,"EEE");
  40.         StudentList student3 = new StudentList("Sunja",193,"ECP");
  41.  
  42.         ArrayList<StudentList> array = new ArrayList<>(3);
  43.         array.add(student1);
  44.         array.add(student2);
  45.         array.add(student3);
  46.  
  47.         for(StudentList val: array){
  48.             System.out.println(val.Id+" "+val.name+" "+val.major);
  49.         }
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top