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
Llana [10]
3 years ago
14

Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar. What will be the ou

tput of the following code?
class Vehicle public static int counter = 0;
public int printCounter_val ) counter = counter + 1;
return counteri public class test
Vehicle public static void main(String args[l) f Vehicle v1=new vehicle();
v1.printCounter val Vehicle v2=new Vehicle() ;
system.out.printin (v2.printCounter_val )):
The output will be______
Computers and Technology
1 answer:
lord [1]3 years ago
8 0

Answer:

2

Explanation:

The output of the Java program is 2. The public Vehicle class is defined with the class variable 'counter'. When a Vehicle class object is instantiated, the counter variable increments by one.

In the program, the two instances of the class are created, incrementing the counter variable to two, the print statement outputs 2 as the result of the program.

You might be interested in
Given half a chance other people at work will take advantage of you
Damm [24]

have self-control and if you have a problem dont be afraid to speak your mind, show other people you mean buisness, but be polite to aviod starting more problems

3 0
3 years ago
Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
hammer [34]

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main() {

int len;

cout<<"Length: ";  cin>>len;

string inpt;

vector<string> vect;

for(int i =0;i<len;i++){

   cin>>inpt;

   vect.push_back(inpt); }

char ch;

cout<<"Input char: ";  cin>>ch;  

for(int i =0;i<len;i++){

   size_t found = vect.at(i).find(ch);  

       if (found != string::npos){

           cout<<vect.at(i)<<" ";

           i++;

       }

}  

return 0;

}

Explanation:

This declares the length of vector as integer

int len;

This prompts the user for length

cout<<"Length: ";  cin>>len;

This declares input as string

string inpt;

This declares string vector

vector<string> vect;

The following iteration gets input into the vector

<em>for(int i =0;i<len;i++){ </em>

<em>    cin>>inpt; </em>

<em>    vect.push_back(inpt); } </em>

This declares ch as character

char ch;

This prompts the user for character

cout<<"Input char: ";  cin>>ch;  

The following iterates through the vector

for(int i =0;i<len;i++){

This checks if vector element contains the character

   size_t found = vect.at(i).find(ch);  

If found:

       if (found != string::npos){

Print out the vector element

           cout<<vect.at(i)<<" ";

And move to the next vector element

           i++;

       }

}  

4 0
3 years ago
What is the main idea of this article? Please someone help me. I will give brainliest answer
mart [117]
The main idea of this article is that theme parks are conducting scientific research that is benefiting the community. Hope this helps!
8 0
3 years ago
The gene form of a trait is called a(n) ​
Rom4ik [11]

Answer:

alleles

Explanation:

7 0
3 years ago
Which data type is -7
bixtya [17]

Answer:

integer

Explanation:

4 0
3 years ago
Other questions:
  • In a game, your character cleverly places an electronic bug on an unsuspecting felon's jacket to track his movements. The bug tr
    10·2 answers
  • When was unicode invented?
    13·1 answer
  • 50 POINTS!!!!
    8·1 answer
  • Optimizing a network to handle more traffic by adding new specialized software is an example of ______ scaling. Adding additiona
    9·1 answer
  • In bankruptcy, most of a debtor’s assets will probably be used to repay unsecured debt
    9·1 answer
  • The default (preset slide layouts are set up in ____ orientation.
    15·1 answer
  • ____________________ is the primary code humans use to communicate. (Points : 1
    9·1 answer
  • Combining two or more cells to make one is called​
    8·1 answer
  • What symbol indicates that material has been copyrighted?
    8·2 answers
  • Launa is reviewing several videos from her friends doing the latest dance challenge before they are published on their own
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!