Given:
What is the result?
Correct Answer:
D
Given the code fragment:
List
“101, Peter, HR”);
empDetails.stream()
.filter(s-> s.contains(“1”))
.sorted()
.f orEach(System.out::println); //line n1
What is the result?
Correct Answer:
A
Given:
public class Canvas implements Drawable { public void draw () { }
}
public abstract class Board extends Canvas { }
public class Paper extends Canvas { protected void draw (int color) { }
}
public class Frame extends Canvas implements Drawable { public void resize () { }
}
public interface Drawable { public abstract void draw ();
}
Which statement is true?
Correct Answer:
E
Given the code fragments:
class MyThread implements Runnable {
private static AtomicInteger count = new AtomicInteger (0); public void run () {
int x = count.incrementAndGet(); System.out.print (x+” “);
}
}
and
Thread thread1 = new Thread(new MyThread()); Thread thread2 = new Thread(new MyThread()); Thread thread3 = new Thread(new MyThread()); Thread [] ta = {thread1, thread2, thread3};
for (int x= 0; x < 3; x++) { ta[x].start();
}
Which statement is true?
Correct Answer:
A
Given the content of /resourses/Message.properties: welcome1=”Good day!”
and given the code fragment: Properties prop = new Properties ();
FileInputStream fis = new FileInputStream (“/resources/Message.properties”); prop.load(fis);
System.out.println(prop.getProperty(“welcome1”)); System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1 System.out.println(prop.getProperty(“welcome3”));
What is the result?
Correct Answer:
C