Assuming the port statements are correct, which two code fragments create a one-byte file?
A. OutputStream fos = new FileOutputStream(new File("/tmp/data.bin")); OutputStream bos = new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos); dos.writeByte(0); dos.close();Given:
import java.util.ArrayDeque;
import java.util.Deque;
public class Counter {
public static void main(String[] args) {
Deque
deq.addFirst("one");
deq.addFirst("two");
deq.addFirst("three"); // Line 9
System.out.print(deq.pollLast());
System.out.print(deq.pollLast());
System.out.print(deq.pollLast()); // Line 12
}
}
What is the result?
A. An exception is thrown at runtime on line 9.Given:
import java.util.*;
public class CompareTest {
public static void main(String[] args) {
TreeSet
new Comparator
public boolean compare(String s1, String s2) {
return s1.length() > s2.length();
}
});
set1.add("peach");
set1.add("orange");
set1.add("apple");
for (String n: set1) {
System.out.println(n);
}
}
}
What is the result?
A. peach orange appleGiven:
import java.util.*;
public class SearchText {
public static void main(String[] args) {
Object[] array1 = new Object[3];
array1[0] = "foo";
array1[0] = 1;
array1[0] = 'a';
int index = Arrays.binarySearch(array1, "bar");
System.out.println(index);
}
}
What is the result?
A. ?1Given:
public class SuperThread extends Thread {
public void run(String name) {
System.out.print("Thread");
}
public void run(Runnable r) {
r = new runnable() {
public void run() {
System.out.print("Runnable");
}
};
}
public static void main(String[] args) {
Thread t = new SuperThread();
A. start(); } } Which two are true?Given the code fragment:
public void ReadFile (String source) {
char[] c = new char [128];
int cLen = c.length;
try (FileReader fr = new FileReader (source)) {
int count = 0;
int read = 0;
while ((read = fr.read(c)) != -1) {
count += read;
}
System.out.println("Read: " + count + " characters.");
} catch (IOException i) {
}
What change should you make to this code to read and write strings instead of character arrays?
A. Change FileReader to Readers.The default file system includes a logFiles directory that contains the following files: Log-Jan 2009 log_0l_20l0 log_Feb20l0 log_Feb2011 log_10.2012 log-sum-2012 How many files Hoes the matcher in this fragment match? PathMatcher matcher = FileSystems.getDefault ().getPathMatcher ("glob: *???_*1?" );
A. OneWhat is the result of invoking Car's scop method?
A. Both vehicles and Motorized's stop methods are invoked.Given the code fragment:
SimpleDataFormat sdf;
Which code fragment displays the three-character month abbreviation?
A. SimpleDateFormat sdf = new SimpleDateFormat ("mm", Locale.UK); System.out.println ("Result:" + sdf.format(new Date()));Given: public class A { //Line 1 private void a() {}; //Line 2 class B { //Line 3 private void b(){{ //Line 4 a();{ //Line 5 }{ //Line 6 }{ //Line 7 public static void main(String[] args) {{ //Line 8
A. B b = new A().new B();{ //Line 9Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Oracle exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 1Z0-804 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.