Suppose an ArrayList list contains {“red”, “green”, “red”, “green”}. What is the list after the following code? list.remove(“red”);
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()); }}
Which method can be used to create an input object for file…
Which method can be used to create an input object for file temp.txt?
Which class contains the method for checking whether a file…
Which class contains the method for checking whether a file exists?
Show the output of the following code: String[] array = {“re…
Show the output of the following code: String array = {“re…”…
The output from the following code is ________.java.util.Arr…
The output from the following code is ________.java.util.ArrayList list = new java.util.ArrayList();list.add(“New York”);java.util.ArrayList list1 = list;list.add(“Atlanta”);list1.add(“Dallas”);System.out.println(list1);
Given two reference variables t1 and t2, if t1 == t2 is true…
Given two reference variables t1 and t2, if t1 == t2 is true, t1.equals(t2) must be ________.
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”); }}
Analyze the following code:public class Test { int x; public…
Analyze the following code:public class Test { int x; public Test(String t) { System.out.println(“Test”); } public static void main(String[] args) { Test test = new Test(); System.out.println(test.x); }}
What is displayed by the following code? System.out.print(“H…
What is displayed by the following code? System.out.print(“Hi, ABC, good”.matches(“ABC “) + ” “); System.out.println(“Hi, ABC, good”.matches(“.*ABC.*”));