Which two items are fields?

Given:
<code>
public class ScopeTest {
int j, int k;
public static void main(String[] args) {
ew ScopeTest().doStuff(); }
void doStuff() {
nt x = 5;
oStuff2();
System.out.println(“x”);
}
void doStuff2() {
nt y = 7;
ystem.out.println(“y”);
or (int z = 0; z < 5; z++) {
System.out.println(“z”);
System.out.println(“y”);
}
</code>
Which two items are fields?

Given:

public class ScopeTest {
int j, int k;
public static void main(String[] args) {
ew ScopeTest().doStuff(); }
void doStuff() {
nt x = 5;
oStuff2();
System.out.println("x");
}
void doStuff2() {
nt y = 7;
ystem.out.println("y");
or (int z = 0; z < 5; z++) {
System.out.println("z");
System.out.println("y");
}

Which two items are fields?

A.
j

B.
k

C.
x

D.
y

E.
z



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Oene Bakker

Oene Bakker

Source:
public class ScopeTest {
int j;
int k;

public static void main(String[] args) {
new ScopeTest().doStuff();
}

void doStuff() {
int x = 5;
doStuff2();
System.out.println(“x”);
}

void doStuff2() {
int y = 7;
System.out.println(“y”);

for (int z = 0; z < 5; z++) {
System.out.println("z");
System.out.println("y");
}
}
}