CORRECT
DOUBT
ANS: 1-5
ANS: 543214321321211
ANS: public List<Integer> foo(Set<Charsequence>m) {..}
Public List<Integer>foo(TreeSet<String>m){…}
ANS: 4
ANS: 08
ANS: NumberFormat formatter =
NumberFormat.getCurrencyInstance(locale);
ANS: short sh = (short)’A’;
float x = 1f;
int x = 12_34;
ANS: denial of service attack against any reachable machine
ANS: Joe -
null
[A, B, C]
[A, B, C]
ANS: module PrintServiceProvider {
requires PrintServiceAPI;
provides org.printservice.spi.Print with
com.provider.PrintService;
}
ANS: CNY -> 6.42 -
EUR -> 0.84 -
GBP -> 0.75 -
USD -> 1.00
ANS: to process the current item and return a stream
ANS: abcd
ANS: Double d = list.get(0);
ANS: @Meal(mainCourse=”pizza”)
@Meal(mainCourse=”salad”)
public class Main {
} Most Voted
@Meal(mainCourse=”pizza”, starter=”snack”,
dessert=”pudding”) public class Main {
}
ANS: System.out.println(Season.SPRING);
System.out.println(Season.valueOf(“SPRING”));
System.out.println(sA[1]);
ANS: setGCount(g);
aCount=a;
ANS: Locale.setDefault(Locale.JAPAN);
ResourceBundle messages =
ResourceBundle.getBundle(“messages”);
String message =
MessageFormat.format(msg.getString(“message”),“Joe”,“Jane”)
;
ANS: Test.class -> java.base -
Test.class - > java.sql
ANS: module com.company.sales_app {
requires org.apache.commons.beanutils;
requires org.apache.commons.collections4;
requires org.apache.commons.lang3;
requires org.apache.commons.text;
}
ANS: BiPredicate<Integer, Integer> test = (var x, final var y) -
> (x.equals(y));
BiPredicate<Integer, Integer> test = (Integer x, final Integer y)
-> (x.equals(y));
ANS: Green
ANS: left, right, setLeft, and setRight must be private
ANS: reader.read(characters);
ANS: e
F
J
B
ANS: new Comparator<String>() {
public int compare(String str1, String str2) {
return str1.compareTo(str2);
}
};
ANS: It never finishes.
ANS: Cylinder requires an implementation of
calculateSurfaceArea with two parameters
ANS: .map(testName::compareToIgnoreCase)
.peek(Member::print)
ANS: System.out.print(p2.relativize(p3));
System.out.print(p1.relativize(p3));
ANS: studentNo and classes
ANS:
-----
-----
banana orange apple lemon apple banana lemon orange
ANS:
Hello world!
Bonjour le monde!
ANS: This may not print the same result each time the program
runs
ANS: The compilation fails.
ANS: The compilation fails.
ANS: replace line 3 with
synchronized(test) {
test.count++;
} Most Voted
replace line 1 with private AtomicInteger count = new
AtomicInteger(0); and replace line 3 with
test.count.incrementAndGet();
ANS: change Line 2 to public Double sum ( C collection) {
ANS: The compilation fails due to an error in line 3.
ANS: foo( n -> Integer.toHexString(n) )
foo( Integer::toHexString )
ANS: @interface Author {
String name() default “”;
String date();
}
ANS: The program prints Process()called 2.
ANS: MyInterface1
ANS: Good Night, Potter
ANS: 357
ANS: line n4
ANS: A java.lang.UnsupportedOperationException is thrown.
ANS: 9001: APPLICATION ERROR-9001-MyFile.txt
ANS: @FunctionalInterface
interface InterfaceD {
int breed(int x);
}
@FunctionalInterface
interface InterfaceD {
int breed(int x);
}