subject
Computers and Technology, 08.10.2019 02:20 Meiyuh1

What is the output of the second println statement in the main method?
public class foo {
int i;
static int s;

public static void main(string[] args) {
foo f1 = new foo();
system. out. println("f1.i is " + f1.i + " f1.s is " + f1.s);
foo f2 = new foo();
system. out. println("f2.i is " + f2.i + " f2.s is " + f2.s);
foo f3 = new foo();
system. out. println("f3.i is " + f3.i + " f3.s is " + f3.s);
}

public foo() {
i++;
s++;
}
}
a. f2.i is 1 f2.s is 1
b. f2.i is 1 f2.s is 2
c. f2.i is 2 f2.s is 2
d. f2.i is 2 f2.s is 1

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:20, kimmmmmmy333
Octothorpe is another name for what common computer keyboard symbol?
Answers: 1
image
Computers and Technology, 25.06.2019 08:30, Anliz0179
What is the chief concern of cloud computing?
Answers: 1
image
Computers and Technology, 25.06.2019 09:30, cheesecake1919
Evaluate the following code segment. what is the value of count after execution? int count = 1; for(int outer = 0; outer < 4; outer++) for(int inner = 1; inner < 3; inner++) count++; 1 3 9 12 13
Answers: 1
image
Computers and Technology, 25.06.2019 10:50, tsmalls70988
4.9: population write a program that will predict the size of a population of organisms. the program should ask the user for the starting number of organisms, their average daily population increase (as a percentage, expressed as a fraction in decimal form: for example 0.052 would mean a 5.2% increase each day), and the number of days they will multiply. a loop should display the size of the population for each day. prompts, output labels and messages. the three input data should be prompted for with the following prompts: "enter the starting number organisms: ", "enter the daily increase: ", and "enter the number of days the organisms will multiply: " respectively. after the input has been read in successfully, a table is produced, for example: 2 300.0 4 675.0 under the heading is a line of 29 dashes followed by one line for each day, showing the day number and the population at the beginning of that day. input validation. do not accept a number less than 2 for the starting size of the population. if the user fails to satisfy this print a line with this message "invalid. must be at least 2. re-enter: " and try to read the value. similarly, do not accept a negative number for average daily population increase, using the message "invalid. enter a non-negative number: " and retrying. finally, do not accept a number less than 1 for the number of days they will multiply and use the message "invalid. enter 1 or more: ".
Answers: 1
You know the right answer?
What is the output of the second println statement in the main method?
public class foo {

Questions in other subjects: