--- in is already defined in main(java.lang.String[]) --- ERROR MESSAGE DRIVING ME MAD
<p>I'm a student starting out on my first programming module. The textbook I'm working from is 'Java for Everyone', Cay Horstmann. I'm on chapter 2.4 - Constants. I have copied and checked (over 15 times!) the code directly from the book, however every time I compile it produces the compile error <strong>in is already defined in main(java.lang.String[])</strong>. </p>

<p>It highlights <strong>Scanner in = new Scanner(System.in);</strong> as being the problem. I have written another extremely simple program which also includes <strong>Scanner in = new Scanner(System.in);</strong> and I had exactly the same problem. </p>

<p>I have tried to find the solution, I've reinstalled both Java JDK and BlueJ (compiler), but nothing has worked. I have Googled the problem, but I'm unable to find anything which matches my problem. I am a Java virgin, so to be honest it's pretty difficult to work out where I should be looking.</p>

<p>Any help would be greatly appreciated. I'm behind a couple of weeks already, and this is holding my progress up considerably. </p>

<p>Thanks, in advance, for any advice offered.</p>

<p>All the best,</p>

<p>Vicky</p>

<pre><code>import java.util.Scanner;

public class Volume2 
{

    public static void main(String[] args)
    {

        final double BOTTLE_VOLUME = 2;  
        final double LITRES_PER_OUNCE = 0.0296; 
        final double CAN_VOLUME = 12 * LITRES_PER_OUNCE; 

        System.out.print("Please enter quantity of bottles: ");

        Scanner in = new Scanner(System.in);

        int bottles = in.nextInt();

        double totalVolume = totalVolume * BOTTLE_VOLUME;

        System.out.print("Please enter the number of cans: ");

        **Scanner in = new Scanner(System.in);** // This is highlighted as being the problem

        int cans = in.nextInt();

        double additionalVolume = cans * CAN_VOLUME;

        totalVolume = totalVolume + additionalVolume;

        System.out.print("The total volume is: ");
        System.out.println(totalVolume);

    }
}
</code></pre>

<hr>

<p>Error Message: <strong>in is already defined in main(java.lang.String[])</strong></p>

<hr>
