question archive I am looking over my graded quiz answers to study for the next test and this is the only question that I missed:   Which of the following can a class NOT be used for? A container for static methods A container for static variables A primitive type A type for method parameters A type for variables   For better comprehension of this question, if it is not too much to ask, I'd like to know why can't classes be used in this situation as well

I am looking over my graded quiz answers to study for the next test and this is the only question that I missed:   Which of the following can a class NOT be used for? A container for static methods A container for static variables A primitive type A type for method parameters A type for variables   For better comprehension of this question, if it is not too much to ask, I'd like to know why can't classes be used in this situation as well

Subject:Computer SciencePrice:2.84 Bought7

I am looking over my graded quiz answers to study for the next test and this is the only question that I missed:

 

Which of the following can a class NOT be used for?

  • A container for static methods
  • A container for static variables
  • A primitive type
  • A type for method parameters
  • A type for variables

 

For better comprehension of this question, if it is not too much to ask, I'd like to know why can't classes be used in this situation as well. Any help is greatly appreciated.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

I have answered the question below.

Step-by-step explanation

The correct answer will be:

 

A primitive type

In Java, we have eight primitive data types: boolean, char, byte, short, int, long, float and double. Java developers included these data types to maintain the portability of java as the size of these primitive data types do not change from one operating system to another.

 

Whereas A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type.

Object is super class of all objects and can represent any user defined object. Since all primitives doesn't inherit from "Object" so we can't use it as a primitive type.

Primitive types have their own bytecode instructions for loading and storing onto the virtual machine stack. So it is not impossible to compile primitive generics into these separate bytecode paths, but it would make the compiler complicated.