字符串方法和字符串修改

时间:2014-02-07 16:27:34

标签: java string

我有一个程序,我希望在空白(....)中完成此程序中缺少的代码 它会是什么?

package exr3;
public class Exr3 {
    public static void main(String[] args) {
        String str1 ="I like ";
        String str2 ="programming ";
        String str3 ="In Java ";
        String str4;
        System.out.println(str1.length());
        str4= (.......)  ;//*how can concatenate the strings str1, str2, and str3 in str4*
        System.out.println(str4);
        str1= str1.toLowerCase();
        System.out.println(str1);
        System.out.println(....);//* how can returns the index of the first occurrence of the string "Love" in str1*
    } 
}

2 个答案:

答案 0 :(得分:0)

str4 = str1+" "+str2 +" "+str3;
System.out.println(str4);

答案 1 :(得分:-1)

索引问题。也许你可以试试这个。 System.out.print(str1.indexOf("L"))