Java 5일차 String 테스트

import java.util.Scanner;

public class StringTest
{
public static void main(String[] args)
{
String a = "StringTest.java";
String b = "StringTest.java";

String c = new String("SringTest.java"); // heap memory

if(a==b) System.out.println("true");
else System.out.println("false");

if(a.equals(c)) System.out.println("true");
else System.out.println("false");

Scanner d = new Scanner(System.in);
String e = d.next();

if(e.matches(".*@.*")) System.out.println("true");
else System.out.println("false");
}
}

댓글 없음: