⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 othermethods.java

📁 《A first book of java》by Gary J.Bronson 北大出版社
💻 JAVA
字号:
import java.lang.*;
public class OtherMethods
{
  public static void main(String[] args)
  {
     
    String string1 = "LINEAR PROGRAMMING THEORY";
    String s1, s2, s3;
    int j, k, l;

    System.out.println("The original string is " + string1);

    j = string1.indexOf('I');
    System.out.println("  The first position of 'I' is " + j);

    k = string1.indexOf('I', (j+1));
    System.out.println("  The next position of 'I' is " + k);

    l = string1.lastIndexOf('I');
    System.out.println("  The last position of an 'I' is " + l);

    j = string1.indexOf("THEORY");
    System.out.println("  The first location of \"THEORY\" is is " + j);

    k = string1.lastIndexOf("ING");
    System.out.println("  The last index of \"ING\" is " + k);

    s1 = string1.substring(2,6);
    s2 = string1.substring(18,22);    
    s3 = string1.substring(6,14);    
    
    System.out.println(s1.concat(s2).concat(s3));
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -