[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Problems compiling

I have a program that will not compile using javac command in my command prompt i get this as a response
Note: Lotto.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

I'm not sure what that means and is there something i can do to avoid this?

It work in my IDE but i need it to compile just using the javac command in dos prompt.

Here is the code
// ip3: Loto.java
//  random integers.
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;

public class Lotto
      public static void main( String[] args )
         Set lottoSet = new HashSet(); //sets can only contain unique values

         //do entire procedure 8 times
         for (int counter = 0; counter < 8; counter++)
             // Loop until lottoSet contains 7 values
             //  since a Set cannot contain duplicates, we know we have 7 unique numbers when size = 7
             while (lottoSet.size() != 7)
                // pick random number between 1 - 35 and add it to set
             } // end while

             //display numbers in set + powerball number

             //clear set so it can be reused
      } // end main

      private static int generateRandomNumber(int range)
        return (int) (range * Math.random() ) + 1;

      private static void displaySet(Set set)

        Iterator it = set.iterator();
        // iterate through set & display the numbers

            // print number followed by a comma
            System.out.print(it.next() + ", ");


        //print powerball number (between 1 & 10) and create a new line
   } // end class lotto java.util.HashSet


  • 2
1 Solution
That's a warning, not an error. Why don't you try following the advice the warning gives you?
This is just a warnng it created the class don't worry about it
drivenitAuthor Commented:
Very Quick and helpful
drivenit, can you tell me why you accepted an answer that duplicated my earlier one?

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now