请问Java运行时出现”the serializable class drawline does not declare a static final serialversio”是什么原因,

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/27 13:46:59

请问Java运行时出现”the serializable class drawline does not declare a static final serialversio”是什么原因,
请问Java运行时出现”the serializable class drawline does not declare a static final serialversio”是什么原因,

请问Java运行时出现”the serializable class drawline does not declare a static final serialversio”是什么原因,
The serializable class XXX does not declare a static final serialVersionUID field of type long
可序列化的类 CreateBPOVIEW 未声明类型为 long 的静态终态 serialVersionUID 字

serialVersionUID作用:
序列化时为了保持版本的兼容性,即在版本升级时反序列化仍保持对象的唯一性.
你可以随便写一个,在Eclipse中它替你生成一个,有两种生成方式:
一个是默认的1L,比如:private static final long serialVersionUID = 1L;
一个是根据类名、接口名、成员方法及属性等来生成一个64位的哈希字段,比如:private static final long serialVersionUID = -8940196742313994740L;之类的.
当你一个类实现了Serializable接口,如果没有定义serialVersionUID,Eclipse会提供这个提示功能告诉你去定义之.
在Eclipse中点击类中warning的图标一下,Eclipse就会自动给定两种生成的方式,如上面所述.如果不想定义它,在Eclipse的设置中也可以把它关掉的,设置如下:
Window ==> Preferences ==> Java ==> Compiler ==> Error/Warnings ==> Potential programming problems
将Serializable class without serialVersionUID的warning改成ignore即可.
如果你没有考虑到兼容性问题时,就把它关掉,不过有这个功能是好的,只要任何类别实现了Serializable这个接口的话,如果没有加入serialVersionUID,Eclipse都会给你warning提示,这个serialVersionUID为了让该类别Serializable向后兼容.
如果你的类Serialized存到硬盘上面后,可是后来你却更改了类别的field(增加或减少或改名),当你Deserialize时,就会出现Exception的,这样就会造成不兼容性的问题.
但当serialVersionUID相同时,它就会将不一样的field以type的预设值Deserialize,这个可以避开不兼容性的问题.

请问Java运行时出现”the serializable class drawline does not declare a static final serialversio”是什么原因, Eclipse运行时提示failed to create the java virtual machine 如何解决 在运行java工程启用tomcat6时出现A configuration error occured during startup错误是怎么回事?错误信息为A configuration error occured during startup.Please verify the prefrence field with the prompt: error.Transport library not fou The project:test which is referenced by the classpath,does not exist.每次运行java项目都会出现此报错, 在Java中我运行的程序出现 can not find symbol,这是什么情况! 安装JAVA出现问题:the installer cannot proceced with the current internet connection settings,怎么我在安装JAVA软件时出现了下面的问题:THE INSTALLER CANNOT PROCEED WITH THE CURRENT INTERNET CONNECTION SETTINGS.PLEASE VISIT THE 请问 Copy did not complete normally.Please see the log for more information.该怎么解决运行 Android logcat时出现的.重启eclipse不管用. java.lang.IllegalStateException是什么回事?我这几天运行程序的时候总是出现以下运行结果,java.lang.IllegalStateExceptionorg.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:423)org.apache.jsp.chklogon_js E-Prime 运行错误E-Rrime运行时出现 “Correct Response is not part of Allowable” 的运行错误,请问怎样解决? 如何解决Right mouse click here to insert content在Ecplise中写Java中编辑时出现这样的提示:The document is empty.Right mouse click here to insert content.请问如何解决. java.sql.SQLException:IO 错误:The Network Adapter could not establish the connection启动tomcat项目出现报错,请问该怎么解决 create or replace package testpackage as type test_cursor is ref cursor; end testpackage; create or运行时出现如下问题 是怎么回事?java.sql.SQLException: ORA-06550: 第 1 行, 第 20 列: PLS-00103: 出现符号 ;在需要下列之一 myeclispe5.5运行jsp,提示The import java.util is never used.哪错了? 跑跑卡丁车 运行时出现problem has occurred with the hack shield.the program will be shut down运行时出现problem has occurred with the hack shield.the program will be shut down而无法运行 import java.awt.*,我在MyEclipse里面写下后,下面提示 The import java.awt is never used.我用的是JDK 1.6,在windows里面的那个控制台里面运行HELLOWORLD很正常,现在出现这个错误是什么原因啊? 运行 pr 时出现 a buffer overrun has been detected which has corrupted the pr java程序run时,出现这样的问题 origin7.5运行时出现的对话框,