Help me: Find the error in this java program

import java.util.Random;
public class rad
{
public static void main(String args[])
{
int temp;
Random rand=new Random();
temp = rand.nextInt(6);
System.out.println("the temp is:"+temp);
}
}
the error msg is "wrong number of arguments in the method.
temp=rand.nextInt(6);

Replies

  • pradeep_agrawal
    pradeep_agrawal
    The code is working fine for me. I compiled and executed the code using JDK 6.

    -Pradeep
  • sookie
    sookie
    Hi ziasepsis !

    I think the problem is in version of JDK you are using or may be your JDK is not installed properly. Your above program is compiling as well as running fine in my machine.
    Please let us know "About how and why" if your problem in fixed. 😉

    Thanks !
  • shashank734
    shashank734
    hey this program working proparly on jdk6 please use jdk6 cause in jdk4 their is no random.nextInt.........

    program is working
  • vinora
    vinora
    even it will work in java 1.5
  • Mangesh6688
    Mangesh6688
    Yes It is working fine with jdk1.5.0_06.

You are reading an archived discussion.

Related Posts

hi friend's, I want to about what is file system . and diffrence between FAT and NTFS file system .
Can someone tell me if i understand the CPU fetch and execute cycle correctly? based on the following line of code... LDAA $100 Its motorolla assembly, means load into registerA...
algorithm to find url of a sender Write an algorithm to find the URL of the sender of a mail. The algorithm must be workable With gmail mail server. Pseudo...
at the time of writing a dvd due to some error the dvd ejects out from the optical drive. after that when i reinsert that dvd it asks to insert...
Hello CEans! Name: Abhinav...(ABHI) *Engineering Trade: Electronics and telecommunication final year Location: pune *Occupation: student *Hobbies & Interests: playing badminton,TT,animation,reading books,robotics *Aim in life: least not done yet *I joined...