1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Simora [160]
3 years ago
15

What is the output of the second println statement in the main method?

Computers and Technology
1 answer:
Doss [256]3 years ago
3 0

Answer:

B. f2.i is 1 f2.s is 2

Explanation:

In Java there are two type of variables, first is static variables and second is instance variable. static variable class variable which means you can have only one variable for all instance of that class. But instance variable will only for instance/object of that class.

For this code example, i is and instance variable, for every instance of class Foo, there will be separate i variable. but s is a static variable and that will be associated with class.

So in this program the first instance incremented the s variable and changed its value to 1 as int's default value is 0 in the constructor. So for second instance, the s value changed to 2 that's why it prints f2.s as 2 and as we know i is instance variable and every instance of foo class have there own copy of i variable so it's value will remain same for every instance.

You might be interested in
Anchor hyperlink to position the cursor to the section called sisters? i need a code pls
enot [183]

use an anchor tag(<a>This is an anchor tag</a>) and use the href attribute and set it's destination to the section element who's id or class is "sisters".



Example:

<a href="#Sisters">Click Here!</a>

then you can add this somewhere on the document.

<section id="Sisters">Hello World!</section>

7 0
3 years ago
2. Create a file with the follow integer/string content and save it as fun.txt. 6 fun. 3 hello 10 &lt;&gt; 2 25 4 wow! Write an
Nesterboy [21]

Answer:

see explaination

Explanation:

I made use of python program to solve this.

text file name with fun.txt.

6 fun. 3 hello 10 <> 2 25 4 wow!

Program code:

import re

file = open('fun.txt','r') #for reading file

strings="" #declaring empty string

for k in file:

strings=strings+k #all character in file is storing in strings variable for do operations

pattern = '\s' #for pattern \s is for space

result = re.split(pattern, strings) #split the string with space

for k in range(len(result)): #loop through the list of string

if(k%2) == 0: #checking for integer to time of string

p=int(result[k])

print(result[k+1] *p) #print times of the string(k+1)

Check attachment for output

8 0
3 years ago
What field would you use to store a value from another table?
Levart [38]

Answer:

A. Lookup

Explanation:

You would use the Lookup field to store a value from another table.

7 0
3 years ago
How did domestication of maize make the city of tenochtitlan possible?
umka21 [38]

The farming of maize began in Mesoamerica in 6000 B.C. The domestication of maize made the city of Tenochtitlan possible by providing the Aztecs the ability to feed millions. Unlike the corn that is known today, the early maize had tiny cobs but dramatically became bigger and more nutritious as time passed.


3 0
3 years ago
Read 2 more answers
Working ____ means that you are viewing previously loaded or saved webpages in the browser, but you are not connected to the int
uysha [10]
Working offline is the answer
8 0
3 years ago
Other questions:
  • Describe what is meant by the following:
    14·1 answer
  • You are most likely to use<br> images for photos or digital paintings.
    6·1 answer
  • Which type of operating system is usually used in personal computers
    13·1 answer
  • What is the default text-wrapping option when inserting images into a Word document?
    5·2 answers
  • Which term refers to the blank areas surrounding a document page? *
    15·1 answer
  • UC is trying to switch from legacy CRM to salesforce and wants to keep legacy CRM and salesforce in place till all the functiona
    9·1 answer
  • Write a method that computes the sum of the digits in an integer. Use the following method header: public static int sumDigits(l
    5·1 answer
  • 3) How ash traditional technology and modern
    10·1 answer
  • Which of the following is NOT a data type in Python?<br> integer<br> decimal<br> string<br> float
    15·1 answer
  • What is the core function of an enterprise platform
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!