programmazione-java/src/Name/NameTester.java

31 lines
914 B
Java
Raw Permalink Normal View History

2016-10-13 14:13:36 +00:00
import java.io.*;
2016-10-19 13:41:21 +00:00
import java.util.Scanner;
2016-10-13 14:13:36 +00:00
public class NameTester{
2016-10-19 13:41:21 +00:00
public static void main(String [] args) throws Exception{
2016-10-13 14:13:36 +00:00
2016-10-19 13:41:21 +00:00
Scanner sc = new Scanner(new File("src"));
Name persona = Name.read(sc);
Name persona1;
2016-10-13 14:13:36 +00:00
2016-10-19 13:41:21 +00:00
if(persona!=null)
persona.print(System.out);
else
System.out.println("ERROR");
persona.setTitle("Hand of the Queen");
persona.print(System.out);
System.out.println(persona.getInitials()); //We expect T. L.
persona1 = new Name("King in the North", "Jon", "Snow");
System.out.println(persona1.getNameSurname()); //We expect Jon Snow
System.out.println(persona1.getTitleNameSurname()); //We expect a spoiler
if(persona.equals(persona1)) //We expect Different
System.out.println("Equal");
else
System.out.println("Different");
2016-10-13 14:13:36 +00:00
}
}