Hello to all !!!

I just joined this site 2day & I hope it will be some help 2 me. I'm new to JAVA & I have a professor who stated that we have to learn JAVA on our own. My prgram is due Wed. by 10am. The program is suppose to generate 100 random #'s between 1000-10000 having no duplicate #'s. Here's what I have so far:

import java.util.Random;
import java.io.*;

public class pg0{

public static void main(String[] args){

//used to determine if there are any duplicate #'s:confused:
public boolean trial(){

10 Years
Discussion Span
Last Post by jwenting

Well, you've got a good start. Couple of tips:
a) use [code] and [/code] tags when you post code, so that formatting is preserved. Makes your code more readable for those trying to help ;)

b)your public boolean trial should not be inside main. Make sure there is a closing brace } for main before you define trial.

c) Since you know you need to have 100 numbers, you could store it simply in an array: int [] theNumbers = new int[100]; . I'd recomment that you familiarize yourself with the ArrayList class though (you'll have to use the Integer wrapper for this).

You should post a little more code if you have a problem. We won't do your homework for you, but we're willing to help you if you have problems. ;)


Doesn't 1.5 have autoboxing? (I still use 1.4 so I'm not sure)

I don't remember for sure (it's been several months since I've used Java), but I thought it didn't. Could very well be wrong on that, though.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.