Java Innards
Java Innards
Java Innards
This study source was downloaded by 100000797727937 from CourseHero.com on 04-01-2023 06:49:17 GMT -05:00
https://www.coursehero.com/file/62000114/Java-Innardstxt/
}
}
What is the o/p of the above program?
Runtime error
27) Which class can be used Instead of System.getCurrentTimeMillis() to get a
date and time in Java 8
Clock
*28) Which methods preserve parameter names in Java bytecode (through reflection
API)
All public methods
29) PermGen space has been replaced with which of these in Java 8
Metaspace
30) Which method is used to connect the consumer to the source in reactive
programming
subscribe()
31) DateTimeFormatter dateFormat=DateTimeFormatter.ISO_DATE;
LocalDate dateOfBirth= LocalDate.of(2015,Month.FEBRUARY,31);
System.out.println(dateFormat.format(dateOfBirth));
Choose the correct option.
Java DateTimeException
32) Which is new command line tool for the Nashorn JavaScript engine in java 8
jjs
33) DateTimeFormatter formatter=DateTimeFormatter.ofPattern("EEEE",Locale.US);
System.out.println(formatter.format(LocalDateTime.now()));
Choose the correct output.
Friday
34) Which of these should be used to show package-level and class-level
dependencies of Class files in Java 8
jdeps
35) LocalDate date1 = LocalDate.now();
LocalDate date2 = date1.plus(1, ChronoUnit.MONTHS);
Period period = Period.between(date2, date1);
System.out.println("Period: " + period);
Choose the correct output.
compilation error
36) 'map' and 'filter' are
Intermediate operation
37) Which of the following is correct about Java 8 lambda expression?
Both the options mentioned
38) In java 8, Static methods cannot be added to a Interface
True
39) ZoneId zoneId=ZoneId.of("Asia/Singapore");
ZonedDateTime.of(LocalDateTime.now(),zoneId);
System.out.println(ZonedDateTime.getOffset());
Assume that the offset value for Asia/Singapore time zone from UTC/Greenwich
is +08:00. Choose the correct option.
Prints +08:00 [Asia/Singapore]
40) import java.time.Clock;
public class App{
public static void main(String [] args){
final Clock clock=Clock.systemUTC();
System.out.println(clock.instant());
System.out.println(clock.millis());
}
}
Output for the above code is
compile and execute without any error
o/p : 2018-02-02T09:29:13.516611Z
1517563753614
41) Which of the following can be a valid input for jdeps dependency analyzer?
All the options mentioned
42) Example of functional interfaces in Java 8
This study source was downloaded by 100000797727937 from CourseHero.com on 04-01-2023 06:49:17 GMT -05:00
https://www.coursehero.com/file/62000114/Java-Innardstxt/
Both
43) Which of the following is the correct lambda expression which add two
numbers and return their sum?
Both
44) LocalDate date1 = LocalDate.now();
LocalDate date2 = date1.plus(1, ChronoUnit.MONTHS);
Period period = Period.between(date2, date1);
System.out.println("Period: " + period);
Choose the correct output.
Period: P-1M
45) Lambda Expressions in Java allow us to treat
Code as data
46) import java.util.Optional;
public class App {
public static void main(String[] args) {
String[] str = new String[10];
str[5] = null;;
str[4] = "JAVA OPTIONAL CLASS EXAMPLE";
Optional<String> checkNull = Optional.ofNullable(str[5]);
if(checkNull.isPresent()){ // It Checks, value is present or not
String lowercaseString = str[5].toLowerCase();
System.out.print(lowercaseString);
}else
System.out.println("String value is not present");
}
}
Choose the correct output.
String value is not present
*false 47) Object o = () -> {System.out.println(�Example�); }; Object o can be
replaced with ?
All the options mentioned
This study source was downloaded by 100000797727937 from CourseHero.com on 04-01-2023 06:49:17 GMT -05:00
https://www.coursehero.com/file/62000114/Java-Innardstxt/
Powered by TCPDF (www.tcpdf.org)