fork download
  1. //What is the output of the following code? (Select 1 option.)
  2. class Laptop {
  3. String memory = "1GB";
  4. }
  5. class Workshop {
  6. public static void main(String args[]) {
  7. Laptop life = new Laptop();
  8. repair(life);
  9. System.out.println(life.memory);
  10. }
  11. public static void repair(Laptop laptop) {
  12. laptop = new Laptop();
  13. laptop.memory = "2GB";
  14. }
  15. }
Success #stdin #stdout 0.08s 40716KB
stdin
Standard input is empty
stdout
1GB