Advertisement
obernardovieira

Direct get (no return method)

Jun 1st, 2017
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.25 KB | None | 0 0
  1. class Car {
  2.  
  3.     public Car() {
  4.  
  5.     }
  6.  
  7.     public String val() {
  8.         return "Mercedes";
  9.     }
  10. }
  11.  
  12. class ObjectC {
  13.  
  14.     private Car car = new Car();
  15.  
  16.     public String getInfo = car.val();
  17.  
  18. }
  19.  
  20.  
  21.  
  22.  
  23. //
  24.  
  25. System.out.println(classTotest.methodToTest().getInfo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement