Help me: Find the error in this java program

zia.sepsis

zia.sepsis

@ziasepsis-0NGPzn Oct 26, 2024
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

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • pradeep_agrawal

    pradeep_agrawal

    @pradeep-agrawal-rhdX5z Aug 9, 2009

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

    -Pradeep
  • sookie

    sookie

    @sookie-T06sFW Aug 30, 2009

    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

    @shashank734-jxXXKs Aug 31, 2009

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

    program is working
  • vinora

    vinora

    @vinora-HBFblK Sep 1, 2009

    even it will work in java 1.5
  • Mangesh6688

    Mangesh6688

    @mangesh6688-2pfEFZ Sep 2, 2009

    Yes It is working fine with jdk1.5.0_06.