Linkedin offers an online quiz to test React.js skills. I collected questions from this test. 1) When do you use useLayoutEffect? ( ) to change the layout of the screen ( ) when you need the browser to paint before the effect runs (*) to complete the update ( ) to optimize for all devices 2) How do you fix the syntax error that results from running the code? const person = (firstName, lastName) => { first: firstName, last: lastName } console.log(person("Jill", "Wilson")); ( ) Add a return statement before the first curly brace (*) Wrap the object in parentheses ( ) Call the function from another file ( ) Replace the object with an array 3) What is the children prop? ( ) a property that lets you pass data to child elements (*) a property that lets you pass components as data to other components ( ) a property that lets you set an array as a property ( ) a property that adds child components to state 4) What is [e.ta...
In "Cracking the Coding Interview" by J. Laakmann McDowell, I found an interesting question concerning the influence of private constructors on inheritance in Java. I know that this is not forbidden in Java, so I'm wondering in which cases it might be useful. In Java, it is not possible to inherit a class with a private constructor. But if this class is internal, the parent class can access all private methods of internal classes. Thus, the inheritance of internal classes with private constructors is possible in the scope of the parent class. I think this is useful for implementing Singletons. I want to demonstrate these cases in the following example: import java.util.*; import test.*; public class Main { class PrivateClassA { private PrivateClassA () { System.out.println( "Private constructorA" ); } } /* PrivateClassB inherits the class with the private constructor */ class PrivateC...