English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How do i read numbers into an integer array from the user until he enters 0???
Before this, how do i create an array without specifying the length in [ and ]??

2007-03-14 03:50:33 · 2 answers · asked by kri91-16 2 in Computers & Internet Programming & Design

2 answers

import java.lang.*;

public class ArrayTest
{
public static void main()
{
//Examples of a arrays
int ArrInteger[] = new array[SIZE];

// or
int ArrayInteger[]; //declare array

// intialize each array element starting with zero
ArrayInteger[0] = 123233;

// or use range to set starting point and ending points
ArrayInteger [] = range(0,200);

// and
ArrayInteger[] = {value1,value2,valu3};


// does not return a value
}
}

2007-03-14 04:01:56 · answer #1 · answered by programinglogic 2 · 0 0

in java, u can not create any array without specifying its length, but u can use Vector, it can be size manipulated (without meaning)
about the zero stopping, just put an if condition and a break label

2007-03-14 10:55:34 · answer #2 · answered by abd 5 · 0 0

fedest.com, questions and answers