

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this past exam are: Code Fragment, Integer Value, Decimal Point, Double Value, Decimal Point, Code Fragment, Equivalent Java Expression
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Quiz2 q2 = new Quiz2();
q2.method1( 5 );
public class Quiz { private int a; // Line 3
public void method1( int x ) { int a; // Line 7 int b = x;
a = b * 2; this.a = b * 3;
System.out.println( "a = " + a ); System.out.println( "b = " + b ); System.out.println( "this.a = " + this.a ); System.out.println( "method2() result = " + method2( x ) ); System.out.println( "this.a = " + this.a ); }
private int method2( int x ) { int a = x; int b = this.a;
b = b + 2;
System.out.println( "a = " + a ); System.out.println( "b = " + b ); System.out.println( "this.a = " + this.a );
this.a = b + 2;
return a + 2; } }