Question: class Numbers { public int a; public static int b; public Numbers ( int c ) { a + = c; b + = C;

class Numbers {
public int a; public static int b;
public Numbers(int c){
a+=c;
b+=C;
}
public int get_b){
return b;
}
What is the output of the following code?
#
class Numbers {
public int a; public static int b;
public Numbers(int c){
a+=c;
b+=c;
}
public int get_b) f return b;
}
}
class Main {
public static void main(Stringl] args){
Numbers n1=new Numbers(2);
Numbers n2=new Numbers(3);
System.out.print/n("a: "+n2.a+" b:
"+Numbers.b);
}
class MainClass {
public static void Main (stringl] args)( Numbers n1=new Numbers(2);
Numbers n2=new Numbers(3);
Console.WriteLinel"a: "+n2.at" b:
"+n2.get_bl));
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!