Core Java - Interview Questions and Answers for 'Java methods' - 1 question(s) found - Order By Newest Q1. Can a method return more than one value at a time in Java ? Core Java
Ans. object / native type returned can only be one but an object can comprise of a array , collection or a group of different value types. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java methodsRelated Questions What are the advantages and disadvantages of static variables and static methods ? What are the methods of Object Class ? Which of the following are valid declarations
1. void method(int... x){};
2. void method(int.. x){};
3. void method(int.. .x){};
4. void method(int ...x){};
5. void method(int... x){};
6. void method(int ... x){};
7. void method(int x, int... y){};
8. void method(int... x, int y){};
9. void method(int... x,int... y){};
Which of the following can be marked static ?
a. Methods , Variables and Initialization Blocks.
b. Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
c. Methods , Variables , Initialization Blocks and Outer Classes.
d. Methods , Variables , Initialization Blocks and nested Classes Can we have multiple main methods in a single class ? Why can't we have diamond problem with interfaces ? Which String class does not override the equals() and hashCode() methods, inheriting them directly from class Object? Can we access instance variables within static methods ? What is the difference between these two method declarations ?
private static void method(String[] arg)
and
private static void method(String... arg) Can we declare interface methods as private ?