CrazyEngineers
  • Help me: Find the error in this java program

    zia.sepsis

    Member

    Updated: Oct 26, 2024
    Views: 925
    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);
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • pradeep_agrawal

    MemberAug 9, 2009

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

    -Pradeep
    Are you sure? This action cannot be undone.
    Cancel
  • sookie

    MemberAug 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 !
    Are you sure? This action cannot be undone.
    Cancel
  • shashank734

    MemberAug 31, 2009

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

    program is working
    Are you sure? This action cannot be undone.
    Cancel
  • vinora

    MemberSep 1, 2009

    even it will work in java 1.5
    Are you sure? This action cannot be undone.
    Cancel
  • Mangesh6688

    MemberSep 2, 2009

    Yes It is working fine with jdk1.5.0_06.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register