(写本代码的意图是打印出来“sun”在字符串中出现的次数)可以编译,但运行起来说是超出什么范围的错误,我刚开始学JAVA,搞了好久也解决不了。请高手帮忙调试一下,谢谢!代码如下:
public class TestString
{
public static void main(String[] args)
{
String str="sunjavahpjavaok";
String sToFind="

展开全部
收起
3回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • James

    12人对此回答表示赞同

    public class TestString
    {
    public static void main(String[] args)
    {
    String str="javasunjavahpjavaok";
    String sToFind="java";

    int count=0;
    int index=-1;
    index=str.indexOf(sToFind);
    展开
    12
    0回复
    发布于 5年前

    评论(0)

    收起评论

  • Benjamin

    5人对此回答表示赞同

    给你改了一下,你看看吧:
    public class TestString
    {
    public static void main(String[] args)
    {
    String str="sunjavahpjavaok";
    String sToFind="java";

    int count=0;
    int index=-1;
    index=str.indexO
    展开
    5
    0回复
    发布于 5年前

    评论(0)

    收起评论

  • Lola

    3人对此回答表示赞同

    public class TestString {
    public static void main(String[] args) {
    String str = "--sun--javah-sun-pjava-ssu-ok";
    String sToFind = "java";

    String ss[]=str.split("sun");

    S
    展开
    3
    0回复
    发布于 5年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部