jhx666
为祖国建设添砖java
2020-03-07 16:57
采纳率: 80%
浏览 3.0k
已采纳

java中定义字符串数组

各位大佬,java中怎么实现定义一个字符串数组,让每个索引对应一句话呀?(初学者(*^▽^*))3q~~

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • caozhy
    已采纳

    String[] arr = {"hello world", "welcome to java", "I love China" };
    System.out.println(arr[1]); //输出welcome to java

    点赞 1 评论
  • xml_1024
    xml_1024 2020-03-07 19:14

    String[] str={"AAA","BBB","CCC"};

    点赞 评论
  • DengFei_404
    为南西 2021-06-21 14:25

    String[] arr={"AAA","BBB","CCC"};//默认0组开始

    System.out.println(arr[0]);//输出AAA

    System.out.println(arr[1]);//输出BBB

    System.out.println(arr[2]);输出CCC

    点赞 评论
  • weixin_44607530
    A女士 2021-06-22 19:27

    String [] students = new String [] {"张三","李四","王五"};

    System.out.println(students [0]);

    点赞 评论

相关推荐