JAVA bug "Point is already defined in this compilation unit"

nagaya

Member
Mar 18, 2007
12,671
194
0
machanla adath error ekak

import java.awt.Point;

class Point
{
public static void main(String[] args)
{
Point location = new Point(4,13);
System.out.println("X: " + location.x);
System.out.println("Y: " + location.y);
location.y = 6;
location.x = 7;
System.out.println("X: " + location.x);
System.out.println("Y: " + location.y);
}
}

mehema liwwama enawa

H:\java>javac point.java
point.java:1: Point is already defined in this compilation unit
import java.awt.Point;

kiyala

but;import kaalla ain karama wada karanneth ne;mehema liwwama wada

class Point
{
public static void main(String[] args)
{
java.awt.Point location = new java.awt.Point(4,13);
System.out.println("X: " + location.x);
System.out.println("Y: " + location.y);
location.y = 6;
location.x = 7;
System.out.println("X: " + location.x);
System.out.println("Y: " + location.y);
}
}

Compiler ekatada aul ? matada aul ?
i use JDK6u10

thnx :D
 

chimpa

Junior member
  • Aug 18, 2006
    170
    7
    18
    Machan it seems like you name your class with the same name that your are going to import. That means you have used 'Point' for your class. Try to change the class name to something else.
    But as I feel the compiler should identify the relavant scopes and get the correct classes.
    Seems there also bug reported some time back. Dont knw if that is corrected in the new versions. Just google and see.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4366290
     

    nagaya

    Member
    Mar 18, 2007
    12,671
    194
    0
    chimpa said:
    Machan it seems like you name your class with the same name that your are going to import. That means you have used 'Point' for your class. Try to change the class name to something else.
    But as I feel the compiler should identify the relavant scopes and get the correct classes.
    Seems there also bug reported some time back. Dont knw if that is corrected in the new versions. Just google and see.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4366290
    thnx a lt machan...it didn't notice it...i'm a fool ban...but new thing to remember....thanx a lt machan
     

    lankanatha

    Well-known member
  • Dec 8, 2008
    3,560
    212
    63
    chimpa said:
    Machan it seems like you name your class with the same name that your are going to import. That means you have used 'Point' for your class. Try to change the class name to something else.
    But as I feel the compiler should identify the relavant scopes and get the correct classes.
    Seems there also bug reported some time back. Dont knw if that is corrected in the new versions. Just google and see.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4366290

    ELA KOLLEK NE