Creating struct like data structure in Java

前端 未结 3 1654
Happy的楠姐
Happy的楠姐 2020-12-05 11:48

I am new to Java and I am trying to find out a way to store information like a struct in C. Say for example I want to have a program hire employees. It would take from the

3条回答
  •  广开言路
    2020-12-05 12:22

    I have a big problem with structures not being supported in Java. I am writing an Android app which receives data via Bluetooth from an embedded ARM based device (written in "C"). This data when received is a packed array of bytes which contains the contents of my embedded device's EEPROM.

    In "C", C++, or "C#", I can simply "cast" this stream of bytes to a structure representing the EEPROM on the embedded device and programmatically use the members of the structure simply by referring to them. In Java, I don't have this option and there's no good way to do it since Java (except for an obscure IBM version which supports packed classes) doesn't allow you to have "packed" classes where the class members are packed without headers and footers to each class member.

提交回复
热议问题