...
Kartei Details
Karten | 83 |
---|---|
Sprache | English |
Kategorie | Informatik |
Stufe | Andere |
Erstellt / Aktualisiert | 02.05.2019 / 03.05.2019 |
Weblink |
https://card2brain.ch/box/20190502_ocp_before_exam
|
Einbinden |
<iframe src="https://card2brain.ch/box/20190502_ocp_before_exam/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>
|
Does DateTimeFormatter throw a Checked Exception or an uncheced?
It throws a DateTimeException which is a RuntimeException
Is it dangerous to ommit the generic type when using Predicate or Function?
Yes:
- Compiler Warning
- Auto Boxing might not work as Expected, eg. boolean will neither be autoboxed into a Boolean nor Object!
Does forEach accept an implementation of Function?
No, only a Consumer implementation!
What happens when catching an checked exception that is not declared by any method in the try block?
The code will not compile!
Can you declare a Method as final?
Yes, instance methods, but not static methods!
Must a ENUM enumeration end with a Semicolon?
The semicolon is only required when methods/constructors are declared afterwards!
What is the difference between Optional.orElse(...) and Optional.orElseGet(...)?
- Optional.orElse(T) returns the provided value
- Optional.orElseGet(Supplier<? extends T>) uses the provided supplier to get the default value
Can a Properties Class be instantiated using a Constructor?
Yes
Is InputStream an Interrface?
No, it's an abstract class!
Is Writer an Interface?
No, its an abstract class
How big is a short?
2 Bytes
When does isSameFile return true?
- when p1.equals(p2) -> true
- when on different FS -> false
- when the same file: true
- including symlinks
- may require to open or access both files
Does instant have a plus method?
Yes, but it only supports units of DAYS or smaller!
Is a Patho object immutable?
Yes! Same as with the new DateTime API
When having an updatable result set and calling a updateXX method, are the changes applied immediately?
No, updateRow must be called before the changes are applied on the DB.
Will two objects that return true for equals() will always return 0 when passed to compareTo()?
Multiple comparators can use different orders for comparison, which do not need to match the definition of equality
Do the compare() and compareTo() methods have the same contract for the return value?
Yes
try{...}catch(Error e){throw e;}
Do you have to handle Error?
NO
Is this assert statement valid?
assert x==y : new StringBuilder("Crap")
Yes, the message can be anything but void
Is this a valid boolean declaration?
.123?
Yes
What is returned when resourceBundle.getString("xx") if the given key cannot be found?
A MissingResourceException is thrown
can static be used together with final
Yes, altough it is redundant
What does intstream.count return
An int - not an Optional!
Does the method Collectors.groupingByConcurrent exist?
Yes
If your application is _______________, it must first have been __________________ with respect to supporting multiple languages.
If your application is localized, it must first have been internationalized with respect to supporting multiple languages.
Internationalization means the program is designed so it can be adapted for multiple languages. Localization means the program actually supports multiple locales. Since a localized application must first be internationalized, Option F is the answer. Extracted is not a word commonly used with respect to handling multiple languages.
Does Filemkdir throw an IOException?
NO, if it does not work, false is returend
Is java.io.NotSerializableException a checked exception?
Yes
is java.util.MissingResourceException a checked exception?
No
Is a class allowed to implement multiple interfaces that declare the same default method signature?
Nope, unless it overrides it
is lowerbound read only or write only? WHy?
It is write only:
List<? super Number> can only be of Type List<Number> or List<Object>, therefore it is safe to insert objects, but unsafe.
is a upper bound generic read only or write only?
It is read only:
List<? extends Number> can be of Type List<Integer>, List<Double> etc., therefore it is safe to read a Number objects, but is its unsafe to put sht. in it
What is the difference between the ConcurrentXXX-Classes and the Synchronized classes?
- Concurrent Classes offer a consistent view on the underlying data while iterating
- Synchronized classes just synchronize the individual calls, but iterator is not consistent!
Does FileInputSTream support mark?
NO
new BufferedInputStream(new FileInputStream("x")).close()
Is the FileInputStream closed?
Yes, the high-level streams close the underlyhing streams
What is the difference between package protected and protected?
Protected ist identisch zu package protected plus zugriff von sub-klassen
What does ObjectInputStream.read() return?
an int - as any stream does
What does ObjectInputStream.readObject return?
An Object isntance, you must cast it manually - no generics support!
what is the name of the sorting intermediate-method?
- stream.sorted()
- stream.sorted(Comparator)
Which primitive stream implementations exist?
IntStream, LongStream and DoubleStream
Are allMatch() / anyMatch() / noneMatch() terminal operations?
Yes