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

I want to make a class that has a constructor that takes an integer from the user to define the maximum capacity of an array, below is my code:

public class WordList
{
private String[] Word;

public WordList(int size)
{
Word = new String [size];
}


Why isn't this working?

2006-11-10 02:37:27 · 2 answers · asked by ? 1 in Computers & Internet Programming & Design

2 answers

Hi Aditya,

Can you describe why you say it isn't working? The code you provided should compile just fine. Are you getting an exception at runtime, or are you getting a compiler error? Is the error in some code that is using your WordList class? Please update with some more details.

2006-11-13 05:33:25 · answer #1 · answered by vincentgl 5 · 0 0

what error are you getting? try making everything public.

2006-11-10 11:08:26 · answer #2 · answered by Andrew H 3 · 0 0

fedest.com, questions and answers