More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Parameters are the variables that the method is expected to receive along with the method call. Arguments are the values which are passed on while calling the methods.
Help us improve. Please let us know the company, where you were asked this question :
Ans. No. Because java internally treats var args as arrays and hence both method declarations will generate the same byte code and hence would result in ambiguity while determining call binding.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Likewise classes, methods also provide a way for code reuse and abstraction. Code is reused, clean and easy to understand if classified properly within classes and methods.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Though var args are used rarely but they are pretty useful if a method is expected to receive variable number of arguments. For example - it's pretty useful for the main method as the caller has the flexibility to provide arguments in infinite ways.It provides a convenience and flexibility to the caller.
Help us improve. Please let us know the company, where you were asked this question :
Ans. This is an informative annotation that specify that the interface is a functional interface. A Function Interface has only one abstract method and many default methods. Compiler generates an error if the interface specified with the annotation doesn't abide by the specifications for functional interface.
Help us improve. Please let us know the company, where you were asked this question :
a. One Key and One Value b. Multiple Keys and Multiple associated Values c. Multiple Keys and One associated values with each d. One key and associated values.
Ans. One key and associated values.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  hadoop   bigdata   big data   map-reduce   map reduce   reduce function
Q10. What are instance methods ?
Ans. All methods defined in a class that are not marked static are actually instance methods.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Var args is the feature of Java that allows a method to have variable number of arguments. Var args are used when we are not sure about the number of arguments a method may need. Internally java treats them as array.
Ans. Yes, it will give compilation error and java will complain about duplicate method. Java treat var args internally as arrays and hence would result in same byte code for both method's syntax.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Inline functions , just like C++ Macros is an optimized technique used by compiler to reduce the execution time. If the function is working on pre identified values ( which aren't resolved at runtime ), the function can execute the method and evaluate the outcome at compile time only instead of making a function call at runtime.
In Java, the optimizations are usually done at the runtime or JVM level. At runtime, the JVM perform some analysis to determine which methods to inline. Java compiler would never inline any method and there is no way in java for the developer to explicitly define inlining of methods as it's take intrinsically care of during runtime only.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Inline functions , just like C++ Macros is an optimized technique used by compiler to reduce the execution time. If the function is working on pre identified values ( which aren't resolved at runtime ), the function can execute the method and evaluate the outcome at compile time only instead of making a function call at runtime.
Help us improve. Please let us know the company, where you were asked this question :