answersLogoWhite

0

What is a Java multiple type?

Updated: 8/21/2019
User Avatar

Wiki User

6y ago

Best Answer

There is no such thing. A type represents just one thing and one thing only. That is; an object of type X cannot represent an object of type Y.

You are possibly referring to union, however a union is not a multiple type, it is a type that can have one (and only one) of several possible representations. In order to know which representation is valid, you must embed the union within a class along with a type field. A better solution is for each unique representation to inherit from a common abstract base class.

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a Java multiple type?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does java not support?

Java does not support multiple inheritance.......


Give the structure of multiple inheritance?

Java does not support multiple inheritance. It is done with the help of interfaces in java. a class can implement n number of interfaces, thus showing multiple inheritance. but a class cannot extend multiple classes in java.


What is ambiguity in multiple inheritance?

Java does not support multiple inheritance


What is problem in multiple inheritance?

Java does not support direct multiple Inheritance. Harder to implement, not every language support it: C++ does, Java does not.


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


Can a single Java class subclass extend both InputStream and Reader. True or False?

Java does not have multiple inheritance, so no. Java can use multiple interfaces, though, with the "implements" keyword.


What are the alternatives to inheritence in java?

Java does not support multiple inheritance; a subclass cannot have more than one parent. Java compensates for this with interfaces. A class can implement multiple interfaces, but can only extend one class.


What type of government in java?

Java has a Communist government.


Why you neet interface in java?

When you need the benefits of multiple inheritance while avoiding the DDD (Deadly Diamond of Death). Java doesn't allow multiple inheritance anyway.


What kind of inheritance is not allowed in java?

Java does not allow the multiple inheritance of concrete classes, though it does allow a "hybrid" inheritance of one concrete class and multiple interfaces.


How many values can a method return in Java?

A method in java can declare only one return value and type at a time. For ex: a single method cannot have a code that returns a string in some cases and an integer in other cases. Java compiler does not let you do that. You can only have one return type for every method in java.


Why steganography is good with java?

Steganography is good with JAVA because JAVA is a highly secured language. If we use steganography with JAVA, it will enforce multiple levels of security of data. form: RISHU