具有数组对象的二进制文件有帮助 [英] Binary files with array objects help

查看:50
本文介绍了具有数组对象的二进制文件有帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我犯了一个错误,但我想知道是否有人可以告诉我我犯的错误类型。我知道我可以将整个数组写入文件,但我想为每个客户创建单独的二进制文件。然后我想读出二进制文件......其中一个或全部。


有人能帮助我吗?谢谢。

I know I''m making a mistake, but I''m wondering if someone could tell me the type of mistake I''m making. I know I can write the whole array to a file, but I want to create separate binary files for each Customer. Then I want to readout the binary file... either one or all of them.

Could someone help me? Thanks.

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

推荐答案

数组''anotherArray''为null;分配阵列befire你取消引用它。


亲切的问候,


Jos
You array ''anotherArray'' is null; allocate the array befire you dereference it.

kind regards,

Jos


所以吧客户[] anotherArray =新客户[2]; ?


我也尝试重做代码......我觉得这样可行,但它不...任何想法?

So make it Customer[] anotherArray = new Customer[2]; ?

Also I tried to rework the code... I thought this would work, but it doesn''t... any idea?

展开 | 选择 | Wrap | 行号


如果抛出了异常,请在catch子句中添加一个语句e.printStackTrace(),你就会确切地知道出了什么问题。


亲切的问候,


Jos


ps。你的代码没有编译;阅读编译器诊断消息。
If an Exception was thrown add a statement e.printStackTrace() to your catch clause and you''ll know exactly what went wrong.

kind regards,

Jos

ps. your code doesn''t compile; read the compiler diagnostic messages.


这篇关于具有数组对象的二进制文件有帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆