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
USPshnik [31]
3 years ago
14

Write code that prints: userNum ... 2 1 Print a newline after each number. Ex: userNum

Computers and Technology
1 answer:
ehidna [41]3 years ago
4 0

Answer:

The program to this question can be given as follows:

Program:

public class data //defining class data

{

//main method

public static void main (String [] as) //declaring main method  

{

int userNum = 4; //declare variable userNum and assign value

for (userNum = 1; userNum <= 4; userNum++)  //loop for print values

{

System.out.println(userNum);  //print values in new lines.

}

}

}

Output:

1

2

3

4

Explanation:

In the above java program code firstly a class "data" is defined, inside this class the main method is defined in which an integer variable userNum is defined that holds a value that is "4".

  • In this method, a for loop is declare that uses variable userNum which starts from 1 and ends with a given value that is equal to 4.
  • Inside a for loop, the print function is used that print userNum variable each values in the newline.  

You might be interested in
If you have a tire blowout while driving on the highway you should A. Not use your brakes B.Take your foot off the brakes C.Rele
Zepler [3.9K]

D. All of the above

Cruise control will flip out and try to stabilize and pressing on the brakes will help stabilize the vehicle.

8 0
3 years ago
What is the code for Pong that would work on Khan Academy?
Rashid [163]
Draw = function() {
if () {
if (keyCode === ){
();
}
else if (keyCode === ) {
();
}
}
};
7 0
3 years ago
Class testing of object-oriented software is equivalent to unit testing for traditional software.
qaws [65]
The answer is B) True
7 0
3 years ago
Sometime you are not answer my question . why this is occur to me? please, help me
notka56 [123]

I have no clue why it happens thanks for points

3 0
3 years ago
Lets say you wanted to creat a table showing how many people in each department preferred salad, pizza, or sandwiches for lunch.
Fantom [35]

SALAD,PIZZA.SANWICHES put a mark under the one you like best

please gimme branly

6 0
3 years ago
Other questions:
  • Early personal computer users remember the cumbersome, user-unfriendly DOS system. When Apple introduced System 1 and Microsoft
    9·1 answer
  • Pls help brainliest
    12·1 answer
  • Tahir is setting up a message option before sending an e-mail to a colleague. He goes into the Properties dialog box and chooses
    5·1 answer
  • What provision of the Government Paperwork Elimination Act was designed to encourage a paperless society?
    8·2 answers
  • PLEASE HELP ME!!!!!!!
    7·2 answers
  • A school secretary has been asked to prepare a letter
    12·1 answer
  • Why has the Personal Software Process not been widely adopted by software industry?
    9·1 answer
  • To move the first line of text over five spaces and leave the other lines of the paragraph aligned to the left, use the _____ fe
    12·2 answers
  • If you were any type of fnaf charater who would you be and why?
    10·2 answers
  • This code is supposed to accept a word as input, and then print that word to the screen.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!