普通网友 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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog