Hello all, I am having difficulty understanding how to make an app with statis void main. here are my instructions (And then my code - should I go to the Intermediate Forum? please let me know - this may be easy but I am knew to Java blah blah blah)
Create an Application from this Class Add the method to this class to make it an application. Within this method, instantiate an new object. If there are any parameters provided on the command line when the application is started, use the parameters to �prefill� the list of String values. Test your work. You can either test this using BlueJ and providing a array aggregate value, or using a command prompt and invoking the application using the following: here's my code so far:
(Note: the line numbers may not be actualy line numbers, they are just used for convenience here) Line 102: It strikes me that you forgot to include an open curly-brace at the end of the line. As such, the close-curly brace in line 105 will close the main method, not the if statement. Anyting after line 105 will give you a compilation error. While, of course, yyour style may differ, it is for this reason that I advocate always using curly braces around single-line if/for/while blocks. Line 103: Where is the variable i coming from? Line 109: Should you not be creating a new PhrasesII object, instead of a Phrases object? Also, I do not see where you have a constructor that takes two ints as arguments. For that matter, why are you parsing Integers? It strikes me that the exercise instructions specified to use Strings. Also, why are you checking the args length in line 102? Is this for testing purposes, or what is going on here? Give it another go round with these suggestions, and if you still have probelms, we're here to help....
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joined: Jul 15, 2003
How about this?
no syntax errors - thanks Rob
Joined: Aug 20, 2001
That looks better syntactically; the question is, does the program do what the assignment asks?
If there are any parameters provided on the command line when the application is started, use the parameters to �prefill� the list of String values.
So ask yourself, "Does my program accomplish this?" Run java PhasesII This is a Test at the command line and see what happens. Hint: (If I'm reading the instructions correctly) You should somewhere pass a java.util.List of Strings to your PhasesII object and use that to initialize the entries member variable.