caution.java

来自「《A first book of java》by Gary J.Bronson 」· Java 代码 · 共 27 行

JAVA
27
字号
import java.lang.*;
public class Caution
{
  public static void main(String[] args)
  {
     
    String s1 = "Help";
    String s2 = "Helpless";
    String s3;
    
    System.out.println("The string s1 is: " + s1);
    System.out.println("The string s2 is: " + s2);   
  
    s3 = s2.substring(0,4);
    System.out.println("The string s3 is: " + s3);   

    if (s1 == "Help")
     System.out.println("The first comparison returned a true.");
    else
      System.out.println("The first comparison returned a false.");
    if (s1 == s3)
     System.out.println("The second comparison returned a true.");
    else
      System.out.println("The second comparison returned a false.");
  }
}

⌨️ 快捷键说明

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