Skip to content
Related Articles
Open in App
Not now

Related Articles

Java | Functions | Question 2

Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 28 Jun, 2021
Improve Article
Save Article

public class Main { 
    public static void main(String args[]) { 
       String x = null; 
    static void giveMeAString(String y) 
       y = "GeeksQuiz"

(A) GeeksQuiz
(B) null
(C) Compiler Error
(D) Exception

Answer: (B)

Explanation: Parameters in Java is passed by value. So the changes made to y do not reflect in main().

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!