Hey
i want to create a vector in order to store circles in it.
i did something but im getting a warning error "java uses unchecked or unsafe operations"
if anyone knows whats going wrong let me know
thanks in advance!

import java.util.Vector;
import java.awt.*;
import java.awt.geom.*;

public class CircleList
{
    Vector v = new Vector();
    /**
     * Constructor for objects of class CircleList
     */
    private Circle circle1;

    public void addToCircleList()
    {
        // initialise instance variables
        v.add(circle1);
   
    }

    public void removeCircle()
    {
        v.remove(circle1);
    }
    
    
}
class Circle
{
    private int diameter;
    private int xPosition;
    private int yPosition;
    private String color;
    private boolean isVisible;
    


    public Circle()
    {
        diameter = 30;
        xPosition = 20;
        yPosition = 60;
        color = "blue";
        isVisible = false;
    }
    public static void main(String[] args)
    {
        Circle x = new Circle();
        System.out.println(x.toString());
    }
    

        
}

does it let you run, even after warning ?

yep
but im doing a system.out.println(v);
and it prints out null .
actually i want to store circles in a specified index and at the end to print the state of each of objects i.e toString(). but im using that and im getting a [null] every time
:-/

ive encountered these warnings before, often they don't make a difference at run time but sometimes they do. I shall investigate further!

I know how to disable these warnings. are you using blue j to compile ? if so, go to tools-preferences-miscellaneous-uncheck box for warnings

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.