Which two are successful examples of autoboxing?
Which two are successful examples of autoboxing? (Choose two.) A. String a = "A"; B. Integer e = 5; C. Float g = Float.valueOf(null); D. Double d = 4; E. Long c = 23L; F. Float f = 6.0;
Which two are successful examples of autoboxing? (Choose two.) A. String a = "A"; B. Integer e = 5; C. Float g = Float.valueOf(null); D. Double d = 4; E. Long c = 23L; F. Float f = 6.0;
Which code fragment compiles? A. B. C. D.
Given: var data = new ArrayList<>(); data.add("Peter"); data.add(30); data.add("Market Road"); data.set(1, 25); data.remove(2); data.set(3, 1000L); System.out.print(data); What is the output? A. [Market Road, 1000] B. [Peter, 30, Market Road] C. [Peter, 25, null, 1000] D. An exception is thrown at…
Given: What is required to make the Foo class thread safe? A. No change is required. B. Make the declaration of lock static. C. Replace the lock constructor call with new ReentrantLock (true). D. Move the declaration of lock inside…
Given: var fruits = List.of("apple", "orange", "banana", "lemon"); You want to examine the first element that contains the character n. Which statement will accomplish this? A. String result = fruits.stream().filter(f -> f.contains("n")).findAny(); B. fruits.stream().filter(f -> f.contains("n")).forEachOrdered(System.out::print); C. Optional<String> result =…
Given: Which statement on line 1 enables this code to compile? A. Function<Integer, Integer> f = n -> n * 2; B. Function<Integer> f = n -> n * 2; C. Function<int> f = n -> n * 2; D.…
Assuming the Widget class has a getPrice method, this code does not compile: Which two statements, independently, would allow this code to compile? (Choose two.) A. Replace line 5 with widgetStream.filter(a -> ((Widget)a).getPrice() > 20.00). B. Replace line 1 with…
Assume ds is a DataSource and the EMP table is defined appropriately. What does executing this code fragment do? A. inserts two rows (101, ‘SMITH’, ‘HR’) and (102, ‘JONES’, NULL) B. inserts two rows (101, ‘SMITH’, ‘HR’) and (102, ‘JONES’,…
Given: What is the result? A. The compilation fails at line 9. B. The compilation fails at line 2. C. Hello World D. The compilation fails at line 8.
Given: What is the output? A. null B. A NoSuchElementException is thrown at run time. C. Duke D. A NullPointerException is thrown at run time.