You're trying to assign an int array to an int variable. Instead you should initialise the 'largest' variable to the first value in the array
Java is also case sensitive - 'For' should be 'for'
Make those changes and then if you are still having problems, post your new code and tell us what the problems are - if it doesn't compile show the error messages. If it doesn't work as you expect, tell us what it is doing and why this isn't what you want it to do.
that's telling you that the jvm doesn't know what the variable 'numNames' is in the place where you are using it.
Variables in java have what is called "scope" - they are not universally available anywhere in the code.
BASICALLY, a variable's scope is the set of curly brackets where it is defined. so, taking your code...
Since your variable is defined inside the main() method, that is the only place you can use it. You can make it a class variable, and then refer to it anywhere in the class, or you could pass it into the method. [ December 13, 2007: Message edited by: Fred Rosenberger ]
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop