Question

Which of the following can be returned from a Java method (or function)? Any primitive type...

Which of the following can be returned from a Java method (or function)?

  1. Any primitive type

  1. Any class
  1. 1-dimensional array
  1. Any integer (int)
  1. All of the above

      f) a & b

      g) a, b & d

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The correct option is: e) All of the above

Explanation:

A java method can return:

  • primitive types like char, int, float, etc.
  • Objects of a class
  • arrays of any dimension
Add a comment
Know the answer?
Add Answer to:
Which of the following can be returned from a Java method (or function)? Any primitive type...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Those questions are about Java. Question 2 Which of the following is NOT a wrapper class?...

    Those questions are about Java. Question 2 Which of the following is NOT a wrapper class? Integer Double String Character Flag this Question Question 3 Which of the following kinds of things may be stored directly in an ArrayList? None of the above primitive values Either of these two kinds of data object references Flag this Question Question 4 In this declaration: ArrayList<Point> polygon; what do we call 'Point'? a type argument a wrapper class a collection a variable Flag...

  • Write a java Program Initialize Array. Write a Java method initArray() with the following header to...

    Write a java Program Initialize Array. Write a Java method initArray() with the following header to initialize a one-dimensional array a such that the element values (integers) are twice the index value. For example, if i = 23, then a23 = 46. The function is void with one parameter -- the integer array of a[]. Then write a main() with an int[] array2i size 100 to call

  • DESCRIPTION: The range of integers that can be represented in Java using a primitive data type is...

    DESCRIPTION: The range of integers that can be represented in Java using a primitive data type is only from-263 to 263-1. What if we need to manipulate integer values beyond this range? In this assignment you will write a HugeInteger class which is able to represent arbitrar- ily large integer numbers. This class must implement arithmetic operations on integers such as addition, subtraction, multiplication, division and comparison. You have to implement this class without using Java predefined classes, unless specified...

  • Write an implementation of a generic java BinaryTree class that fits any primitive data type. your...

    Write an implementation of a generic java BinaryTree class that fits any primitive data type. your class at minimum should have the following. Node class with a minimum of three fields and 3 constructor. BinaryTree class should include the following at least 3 Fields, at least 2 constructors, add, remove, find, getSize method (which returns the amount nods in the tree), getHeight (should return the height), countLeftNode (Should return the mount of left node found in the tree), countRightNode (Should...

  • 1.Write code for a Java method, printArray, that takes an int array as parameter and prints...

    1.Write code for a Java method, printArray, that takes an int array as parameter and prints it out, one element per line. public static void printArray (int[] values){ Methods that do NOT return a result have “void” as return type. Notice how an array parameter type is passed, int [] }// end printArray 2.Write code for a Java method that takes in as input parameter an integer number, say num, and returns a double array of size num with all...

  • Which of the four are true? a). Generic code only works with values of reference types....

    Which of the four are true? a). Generic code only works with values of reference types. b). Autoboxing is when a reference type is automatically converted into the corresponding primitive type. c). Java will always add a default constructor to any class that you define. d). All exceptions in Java implement the Throwable interface. e). Generic algorithms allow you to write code that can operate on arguments of multiple different types f). The type wrapper for the int primitive type...

  • Java. For C through H True or false? c. Primitive variables must be objects. d. Integer...

    Java. For C through H True or false? c. Primitive variables must be objects. d. Integer x; generates a compile time error. e. Integer y = new Integer(); generates a compile time error. f. Integer z = new Integer(3); generates a compile time error. g. Integer u = new Integer(3.14); generates a compile time error. h. Integer w = new Integer("345"); generates a compile time error. 1.) What is true of classes that can be used with the enhanced for...

  • Hello, What is the answer to this Java question? Which​ ​of​ ​the​ ​following​ ​is​ ​false​ ​with​...

    Hello, What is the answer to this Java question? Which​ ​of​ ​the​ ​following​ ​is​ ​false​ ​with​ ​respect​ ​to​ ​local​ ​variables? a. Their​ ​lifetime​ ​is​ ​the​ ​execution​ ​time​ ​of​ ​the​ ​method​ ​they​ ​are​ ​declared​ ​in b. Their​ ​scope​ ​is​ ​the​ ​method​ ​they​ ​are​ ​declared​ ​in c. They​ ​are​ ​not​ ​auto-initialised​ ​unless​ ​they​ ​are​ ​elements​ ​of​ ​an​ ​array d. They​ ​must​ ​be​ ​primitive e. They​ ​cannot​ ​have​ ​the​ ​same​ ​name​ ​as​ ​an​ ​instance​ ​variable​ ​in​ ​the​ ​same​ ​class f. Select​ ​this​ ​option​...

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

  • (This program is to be done on Java) 7.5 ArrayLists Part 1 A significant limitation of...

    (This program is to be done on Java) 7.5 ArrayLists Part 1 A significant limitation of the array is you cannot add or delete elements from the array. The size is fixed and you can only do workarounds. An example is the following: public class Ex_7_5_Prep { public static void main(String[] args) { int[] intArray = { 5, 10, 15, 20 }; printArray(intArray); intArray = addNewElement(intArray, 25); printArray(intArray); } public static int[] addNewElement(int[] originalArray, int newInt) { // Create new...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT