answersLogoWhite

0


Best Answer

public static final void readIntList() {

// set up our input buffer

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

String currentLine;

// I'll use a linked list for this;

// replace it with whatever best suits your purpose

List<Integer> intList = new LinkedList<Integer>();

// loop until we read -999

while (!(currentLine = in.readLine()).equals("-999")) {

try {

// convert from string to int

int currentNumber = Integer.parseInt(currentLine);

// add to the list

intList.add(currentNumber);

} catch (final NumberFormatException ex) {

// we go here if the user didn't type in an integer

}

}

// display our lovely list

System.out.println(intList);

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a function that will accept a series of integer values in a list. Terminate sequence by typing -999. Then display the content of list.?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Function of a monitor?

A Function of a monitor is to display the output results


What the function of display?

To show something.


How do you change my multi function display for Fahrenheit to Celsius for temp?

The answer depends on what equipment has your multi-function display. I suggest you refer to the user manual.


What is Censorship in photography?

It is the banning of pictures that display arguable content.


What is the function of the computers monitor?

To display graphics


Suppose you are working on a display for Thanksgiving The drawings construction paper and labels you use to make up the display are examples of what?

content


Write a function to reverse a string and to display it?

Yes.


What is the function of a MAN6760?

Seven Segment Display


Why use the void display()?

void display is the function name in which we want to perform some task or it might be to display something. But it has got its residence in the main() function that means that function's inputs are being supplied from the main(). void doesn't return anything so function call is made in main() which doesn't return anything back to it.


What do you mean by the display file interpreter?

A display file interpreter is a software component that reads instructions from a display file and renders them on a display device. It interprets commands related to layout, positioning, and content to generate the visual display seen by the user.


What you use to display information in a chronological list sequence of action or definite steps?

numbered lists


What is one of most widely viewed video content on display devices?

newscasts