What will be the output of following Java code (1)?

16. What will be the output of following Java code?

public class Main {
  public static void main(String[] args) {
    String str = "Hello";
    str = "Bye";
    System.out.println(str);
  }
}
  1. Hello
  2. Bye
  3. Error
  4. All of these

Answer: B) Bye

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.