glennluc

8.3

Mar 6th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. //MemberAccessTest.java
  2. //Private members of class Time1 are not accessible.
  3.  
  4. public class MemberAccessTest
  5. {
  6. public static void main(String[] args)
  7. {
  8. Time1 time = new Time1();
  9.  
  10. time.hour = 7; //error: has private access
  11. time.minute = 15; //error: has private access
  12. time.second = 30; //error: has private access
  13. }
  14. }
Add Comment
Please, Sign In to add comment