Beginner's Question: "*.java uses unchecked or unsafe operations"



Hi all

I have read the net and notice this problem is caused by the version of
compiler between 1.5 and 1.4.

I tried to use the follow codes to overcome the warning msg. "uses unchecked
or unsafe operations" but not able to. Please advice. Thanks.

[code]

public class XXX
{
private ArrayList <Customer> CustDB;
.....
.....
public static void main(String[] args)
{
......
......
......
FileInputStream readFile = new FileInputStream("cust.dat");
ObjectInputStream read = new ObjectInputStream(readFile);

CustDB = (ArrayList<Customer>)read.readObject();
}
}

[/code]

I tried to typecast the read object, but yet the warning still exists.
May I know where have I did wrong?


.



Relevant Pages

  • Re: Beginners Question: "*.java uses unchecked or unsafe operations"
    ... I tried to use the follow codes to overcome the warning msg. ... public static void main ... ObjectInputStream read = new ObjectInputStream; ... don't supply generic type arguments in cast expressions. ...
    (comp.lang.java.help)
  • Re: how to use static methods
    ... 'good' codes and short passages about statics in the textbooks that i ... public static void main{ ... // of MyClass to call an instance method ... *bad* because it looks like you are calling an instance method, ...
    (comp.lang.java.help)
  • Re: how can I stop a thread from sleeping?
    ... > I have a program(like the following codes) which needs to sleep for 20 ... How can i make it stop sleeping if i want it to be alive ... > public static void delay ...
    (comp.lang.java.programmer)
  • how can I stop a thread from sleeping?
    ... I have a program(like the following codes) which needs to sleep for 20 ... How can i make it stop sleeping if i want it to be alive ... public static void delay ...
    (comp.lang.java.programmer)
  • how can I stop a thread from sleeping?
    ... I have a program(like the following codes) which needs to sleep for 20 ... How can i make it stop sleeping if i want it to be alive ... public static void delay ...
    (comp.lang.java.help)