Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_java thread: Why I can't convert time operation?


Message #1 by Edward <zhangsc@n...> on Tue, 18 Jun 2002 14:53:38 +0800
Hello Edward!

Here you code with a bit correction.

Date time1=new Date();
Long times=new Long(time1.getTime());
String startTime=times.toString();


>  I want to convert time operation,like follows:
  
>  Date time1=new Date();
>  long times=time1.getTime();
>  String startTime=times.toString();

>When I compile it,it raise errors:

>F:\java>javac test.java
>test.java:40: long cannot be dereferenced
                String startTime=times.toString();
                                      ^
>test.java:47: cannot resolve symbol

>I know from java1.3.1 doc,Java has method public String toString(),it >returns a String object representing this Long's value.But why I get >errors?
>Any idea will be appreciated!
>Thanks in advance
>Edward

  Return to Index