HarrJ

Day 11

Aug 11th, 2023
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. package mng2023b5;
  2.  
  3. public class Day11C {
  4.     public static void main(String[] args) {
  5.         Day11B callBFile1 = new Day11B();
  6.         Day11B callBFile2 = new Day11B();
  7.        
  8.        
  9.         System.out.println(callBFile1.txtExtrovert);
  10.         callBFile1.wallFlower();
  11.         System.out.println("\n-----(1)-----\n");
  12.        
  13.         callBFile2.txtExtrovert = "Nasa labas na ako";
  14.         System.out.println("BFile2 extrovert value: " + callBFile2.txtExtrovert);
  15.         System.out.println("\n-----(2)-----\n");
  16.        
  17.         Day11B.txtTheOne = "There are multiple instances that call me";
  18.         System.out.println("Using callBFile1");
  19.         callBFile1.wallFlower();
  20.        
  21.         System.out.println("\n-----(3)-----\n");
  22.         System.out.println("Using callBFile2");
  23.         callBFile2.wallFlower();
  24.     }
  25. }
  26.  
  27. //---------------------------
  28.  
  29. public class Day11B {
  30.     public String txtExtrovert = "I'm a public variable";
  31.     private String txtIntrovert = "I'm a very private variable";
  32.     public static String txtTheOne = "I'm the only one";
  33.     private static String txtTheOtherOne = "I'm the hiding one";
  34.  
  35.     public void wallFlower(){
  36.         System.out.println("wallFlower method:");
  37.         System.out.println(txtExtrovert);
  38.         System.out.println(txtTheOne);
  39.         System.out.println("And the +1:");
  40.         System.out.println(txtIntrovert);
  41.         System.out.println(txtTheOtherOne);
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment