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(){

Recommended Answers

All 5 Replies

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. ;)

Thanks for your help.

familiarize yourself with the ArrayList class though (you'll have to use the Integer wrapper for this).

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

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.

5.0 has autoboxing.

P.S I h8 it when kids use h@x0r 5pe@k.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.