普通网友 2017-01-11 14:43 采纳率: 0%
浏览 954
已结题

JAVA小程序编写求大神帮忙

1)Assume there is a string
101_DE|102_AR|103_|104_JK|105_|106_KI|107_|108_BA
where | is the separator and portion before _ is the key and the portion after _ is value.

a) Convert the above string to a two-dimensional array such as below.
arrayname[0][0] is 101
arrayname[0][1] is DE
…..

b) Convert the above string to a Vector of Hashtable and use KEY and VALUE as the parameter name to store the values in Hashtable such as below.
hashtablename.get(“KEY”) is 101
hashtablename.get(“VALUE”) is DE

Hashtable HT = new Hashtable()
HT.put(101,”DE”);
HT.put(“KEY”,101);
HT.put(“VALUE”,”DE”);
HT.put(“KEY”,102);

Integer n = HT.get(101)
HT.get(“KEY”) 101
HT.get(“VALUE”) “DE”

这两题要怎么做,详细代码(JAVA)

  • 写回答

5条回答 默认 最新

  • 普通网友 2017-01-11 14:59
    关注

    第一部分就是给定字符串:101_DE|102_AR|103_|104_JK|105_|106_KI|107_|108_BA
    然后在控制台打印出:
    arrayname[0][0] is 101
    arrayname[0][1] is DE
    …..

    评论

报告相同问题?

悬赏问题

  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题