What Will Be The Output Of The Following Java Codep Pre #217
What will be the output of the following Java code?</p> <pre><code class="language-java" line="1"> class overload { int x; int y; void add(int a) { x = a + 1; } void add(int a , int b) { x = a + 2; } } class Overload_methods { public static void main(String args[]) { overload obj = new overload(); int a = 0; obj.add(6, 7); System.out.println(obj.x); } }</code></pre>
This multiple choice question (MCQ) is related to the book/course
gs gs128 Java.
It can also be found in
gs gs128 Java Classes Methods - Overloading Methods & Argument Passing in Java - Quiz No.1.