Results 1 to 3 of 3
  1. #1
    reddens84 is offline Member
    Join Date
    Jul 2014
    Posts
    12
    Rep Power
    0

    Default java.lang.* package

    It is my understanding that when you write a program, java.lang is automatically/implicitly imported for use... I tried using Math.random() without an import, though, and Netbeans doesn't recognize it.

    When I explicitly import java.lang.Math, my program will run (i.e. the method is recognized), but I get a "hint" saying that I don't need to import.

    Any ideas what could be going on?

    Thanks in advance.
    Last edited by reddens84; 09-23-2014 at 10:10 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: java.lang.* package

    Somewhere in the classpath, you have another class, probably one of your own, named Math.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    reddens84 is offline Member
    Join Date
    Jul 2014
    Posts
    12
    Rep Power
    0

Similar Threads

  1. java.lang.String cannot be cast to java.lang.Boolean
    By putapepe in forum New To Java
    Replies: 7
    Last Post: 04-06-2014, 10:34 PM
  2. Replies: 5
    Last Post: 03-17-2011, 02:26 PM
  3. Replies: 8
    Last Post: 11-04-2010, 01:46 PM
  4. Replies: 2
    Last Post: 09-18-2008, 07:30 AM
  5. couldn't find the package java.lang
    By katie in forum New To Java
    Replies: 2
    Last Post: 08-04-2007, 05:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •