
Let’s change the world one build at a time. I post Java questions. #JavaHokageQuestions
National Capital Region
Joined October 2018
- Tweets79
- Following2.2K
- Followers449
- Likes106
Java Brain Teasers retweeted
My tips for JAVA GC @java @MicroservicesTT @javacodegeeks @Java_Hokage @Java_Champions @Oraclejavamag @JavaPerformance @JavaTune techtalkwithbhatt.com/2019/0…
14. Callable and Supplier are functional interfaces. Both are quite similar since they have an abstract, no-argument method that just supply a value. One of this throws an Exception. Which one is it?
#Java #JavaHokageQuestions
64%Callable
36%Supplier
11 votes • Final results 5
2019 Java Hokage Questions Thread
#Java #JavaHokageQuestions
3
13. Interface fields are implicitly ____?
#Java #JavaHokageQuestions
29%static
21%final
50%both
24 votes • Final results 1
1
Fields in an interface implicitly static and final since interface can't have behavior or state. Interfaces are intended to specify an interaction contract only and not implementation details.
#Java #JavaHokageQuestions
2
12. You can have a top-level static class.
Example (inside StaticClass.java):
public static StaticClass {}
class NestedClass {}
#Java #JavaHokageQuestions
17%true
83%false
0%It depends.
6 votes • Final results 1
11. In Java, you can extend multiple classes since Java supports multiple inheritance of state.
#Java #JavaHokageQuestions
23%true
54%false
23%It depends
13 votes • Final results 1
1
. . . What if methods or constructors from different superclasses instantiate the same field? Which method or constructor will take precedence? Because interfaces do not contain fields, you do not have to worry about problems that result from multiple inheritance of state.
1
1
Java however supports:
1: Multiple inheritance of implementation, ability to inherit method definitions from multiple classes
2: Multiple inheritance of type, ability of a class to implement more than one interface.
docs.oracle.com/javase/tutor…
#Java #JavaHokageQuestions
1
10. Is Java pass-by-reference or pass-by-value?
#Java #JavaHokageQuestions
47%pass-by-reference
45%pass-by-value
8%neither
38 votes • Final resultsSince Java is pass-by-value, it creates a copy of that reference, thus it will now operate on the new reference variable and not the original. Any assignment on the new reference variable will not affect the original.
#Java #JavaHokageQuestions
1
1
If you run this program, it will print “pass-by-value” proving Java is pass-by-value indeed.
#Java #JavaHokageQuestions
1
1
When you run this program, it will print “pass-by-value” thus proving Java is pass-by-value indeed.
#Java #JavaHokageQuestions
1
9. This describes a situation where two or more threads are blocked forever, waiting for each other.
#Java #JavaHokageQuestions
91%Deadlock
0%Livelock
0%Race condition
9%Starvation
11 votes • Final results 1
3

