草庐IT

container_type

全部标签

java - “Type mismatch: cannot convert int to byte”

我看到有人问关于错误“类型不匹配:无法将int转换为字节”的问题。但它们大多是由涉及的算术运算引起的。这是我的案例:(当我想在EclipseKepler中玩位时会发生这种情况)//java7binaryliteralsbytea=0b01111111;//8-bititcompilesbyteb=0b10000000;//8-biterror:Typemismatch:cannotconvertinttobyte.bytec=(byte)0b10000000;//8-bititworksfineifcasted.问题是,如果它是8位并且最高位是1,那么编译器会给出错误。我想知道为什么。

java - 组织.postgresql.util.PSQLException : ERROR: value too long for type character varying(255)

当我执行我的项目时,出现以下错误:目标是使用hibernate将json文本保存到数据库中。Users.java&UsersBooks.java同样,Books.java:@Entity@Table(name="tblbooks")publicclassBooks{@Id@Column(name="bookshareId")privateintbookshareId;@Column(name="author")privateStringauthor;@Column(name="availableToDownload")privateintavailableToDownload;@Col

java - 如何在 Java 中创建 Type 5 UUID?

在python中,要生成Type5UUID,我们可以简单地执行以下操作:importuuidprintuuid.uuid5(uuid.NAMESPACE_URL,'mystring')浏览javadocumentationforjava.util.UUID,我不知道该怎么做。首先,没有提到类型5。他们确实有Type3,但签名是:nameUUIDFromBytes(byte[]name)Staticfactorytoretrieveatype3(namebased)UUIDbasedonthespecifiedbytearray.我们如何在Java中创建Type5UUID?

Java 应用引擎 : "appengine-web.xml does not contain a <threadsafe> element" message

当我尝试在Eclipse中运行Google网络应用程序时,我得到了appengine-web.xmldoesnotcontainaelement并且该应用程序没有运行(好吧,任何新应用程序仍然没有运行)。修复起来并不难(我只是在true文件中添加了一个带有appengine-web.xml值的元素),但我之前没有遇到此错误。这种意外行为的原因可能是什么?提前致谢。 最佳答案 Google在1.6.4的发行说明中宣布了这一点,并在最新版本中强制执行。Omittingthedirectivefromappengine-web.xmlno

Java ArrayList Contain 总是返回 false,尽管它包含相同的值

这是我的洞课classHole{publicinta;publicintb;Hole(inta,intb){this.a=a;this.b=b;}所以我添加了一个包含几个洞的ArrayListpublicvoidcheckPathLoop(intx,inty){//roughcodeArrayListleftFlowInnerHole=newArrayList();//leftholesrulesleftFlowInnerHole.add(newHole(0,1));leftFlowInnerHole.add(newHole(1,5));leftFlowInnerHole.add(ne

java - Ant 中的 "Failed to create task or type antlib:org.apache.maven.artifact.ant:mvn"错误

在build.xml中运行Ant任务时,Ant构建无法运行。我在控制台中收到以下错误:Buildfile:F:\EclipseProjects\my_project\build.xml[typedef]Couldnotloaddefinitionsfromresourceorg/apache/maven/artifact/ant/antlib.xml.Itcouldnotbefound.BUILDFAILEDF:\my_project\build.xml:32:Problem:failedtocreatetaskortypeantlib:org.apache.maven.artifac

java - 有没有办法将开关与 String.contains (""集成)?

我需要检查一个String对象是否包含()各种子字符串,并根据结果执行不同的代码片段。目前我有一系列的elseif。如果可能的话,我想把它转换成一个开关。有办法做到这一点吗?目前:if(SomeString.contains("someSubString")){...dosomething}elseif(SomeString.contains("anotherSubString")){...dosomethingelse}elseif(SomeString.contains("yetanotherSubString")){...dosomethingevenmoredifferent}

java - Protobuf 错误 :Protocol message tag had invalid wire type

我在尝试用java读取消息时遇到以下错误Exceptioninthread"main"com.google.protobuf.InvalidProtocolBufferException:Protocolmessagetaghadinvalidwiretype.atcom.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:78)atcom.google.protobuf.UnknownFieldSet$Builder.mergeFieldF

Postgres类型“ {field type}”只是一个外壳

我使用django&amp;Postgres。我的迁移包含这样的东西:db.create_table('location_locationlevel',(('id',self.gf('django.db.models.fields.AutoField')(primary_key=True)),('name_0',self.gf('django.db.models.fields.CharField')(max_length=75,null=True,blank=True)),('name_1',self.gf('django.db.models.fields.CharField')(max_le

java - "Constructor cannot be applied to given types"当构造函数有继承时

这是我的基类:abstractpublicclassCPUextendsGameObject{protectedfloatshiftX;protectedfloatshiftY;publicCPU(floatx,floaty){super(x,y);}这是它的一个子类:publicclassBeamextendsCPU{publicBeam(floatx,floaty,floatshiftX,floatshiftY,intbeamMode){try{image=ImageIO.read(newFile("/home/tab/Pictures/Beam"+beamMode+".gif")