What is the output of the following code?public class Test {…

What is the output of the following code?public class Test { public static void main(String[] args) { new Person().printPerson(); new Student().printPerson(); }}class Student extends Person { @Override public String getInfo() { return “Student”; }}class Person { public String getInfo() { return “Person”; } public void printPerson() { System.out.println(getInfo()); }}

What is the output of the following code?public class Test {…

What is the output of the following code?public class Test { public static void main(String[] args) { String s1 = new String(“Welcome to Java!”); String s2 = new String(“Welcome to Java!”); if (s1.equals(s2)) System.out.println(“s1 and s2 have the same contents”); else System.out.println(“s1 and s2 have different contents”); }}