Java StringTokenizer exception

My coding have no error but i don't understand why there is error when i run. Below are the complete exception:-

Initializing population...
   at java.util.StringTokenizer.nextToken(Unknown Source)
   at Input.takeinput(
   at schedule.main(
Exception in thread "main" java.lang.IllegalArgumentException: bound must be positive
   at java.util.Random.nextInt(Unknown Source)
   at schedule.createpopulation(
   at schedule.main(

Where does the exception really happen?

For the first error,here's the coding (

File file = new File("input.txt");
        Scanner scanner = new Scanner(file);
            String line = scanner.nextLine();
            //StringTokenizer st = new StringTokenizer(line, ";");
            //input student and sv
                nostud = 0;
                    StudData[nostud] = new Student();
                    StringTokenizer st = new StringTokenizer(line, ";");

and (


For the second error.(

    int ex = r.nextInt(noexm);

and (



First Exception means that you are calling nextToken more than necessary. There is no "next token" on the string you are tokenizing. For example, for the string a;b;c, you can call nextToken only 3 times, the 4th call would throw an Exception like the one you had: NoSuchElementException Second Exception means that your noexm variable is a negative integer, which is not good. Try to debug and find out the value of noexm and figure out why it is negative.

Need Your Help

IBM MobileFirst Add envirnment via ant script

ant ibm-mobilefirst mobilefirst-cli

Is there a way to add environment (android,windows and IOS) using ant with the help of any jar Files.

How do I target a GridViewRow with an AJAX.Net Toolkit PopupExtender? javascript gridview

I have a lot of data to display in a GridView. Because there's so much information per row, I'd like to be able to display additional information when a user clicks on the row, so I thought a