You are free, of course, to use the strings provided by the command line in any way you wish.
Frequently, you may wish the strings were numbers, rather than strings.
Fortunately, you can convert strings to integers using the
parseInt
class method of the Integer
class.
Thus, if you want to supply rating information as a set of command-line arguments, you can produce integers from those arguments as illustrated in the following program, which computes a movie rating:
public class Demonstrate { public static void main(String argv[]) { Movie m = new Movie(Integer.parseInt(argv[0]), Integer.parseInt(argv[1]), Integer.parseInt(argv[2])); System.out.println("The rating is " + m.rating()); } }