answersLogoWhite

0


Best Answer

Every method in java that isn't a class (static) method is automatically "virtual." If you want to disable virtual overrides, make the method "final" in the base class.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

All functions are implicitly virtual in Java, unless they are explicitly declared final.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Do you use virtual functions in Java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Explain why Java programs running on Android systems do not use the standard Java API and virtual machine?

123


What type of java used in java enable phone?

J2ME - Java 2 Micro Edition is generally used in java enabled phones. Simple Java Applications use JVM(Java Virtual Machine) for generating bytecode where as Java Mobile Applications use KVM(KiloByte Virtual Machine) for the same purpose. Reason for this is KVM occupies small amount of memory and hence can be embedded inside a java enabled phone easily.


Why Member functions are not virtual by default?

It depends which language you are using. Java member functions are virtual by default but C++ member functions are not. Java takes the viewpoint that if any member function is declared virtual then all member functions should be declared virtual, so they may as well be virtual by default. However, C++ takes the view that a member function should only be declared virtual if there's a specific reason to declare it virtual. Not all functions are meant to be overridden. Indeed, not all classes are meant to act as base classes. So all member functions are non-virtual by default. Purists will argue that the C++ method is the correct method. After all, there's no point in having a virtual-table if it's never going to be used. Java places the onus on the programmer to eliminate an unused virtual-table, whereas C++ simply doesn't provide one unless you explicitly declare one. However, the real reason C++ uses non-virtual methods by default is because it has to maintain compatibility with a C struct. A C struct is not a class so it has no methods (and therefore no virtual methods). It is a "plain-old-data" or POD structure. In C++, however, a struct is a class. As such, by default, it has a compiler-generated default constructor, default copy and move constructors, default copy and move assignment operators and a default destructor. It also has public access by default. However, because the compiler-generated methods are all trivial member-wise implementations, a C++ struct is backwardly compatible with a POD. Thus C code can use a C++ struct just as if it were a C struct, because both use POD structures by default. If C++ used virtual member functions by default, a struct would not be a POD by default, it would be a base class by default.


Where could one download Java Virtual Machine?

There are many places that claim to be trustworthy downloads for the Java Virtual Machine, but most of those sites can be a very big risk to the safety of one's computer. The most trustworthy vendor of the Java Virtual Machine is the Java website which also offers downloads to the latest updated versions of the JDK and other Java products.


How do you represent a C plus plus non-pure virtual function in UML?

All virtual functions (including pure-virtual functions) are represented in italics. All non-virtual functions are represented normally. There is no differentiation between pure and non-pure virtual functions, however some people append "=0" to distinguish the pure-virtual functions.

Related questions

What is the use of functions in java?

Same as in other languages. To organize commands into logical pieces. However, in Java the functions are called "methods". This is related to the fact that in Java, methods or functions are defined as part of a class.


Explain why Java programs running on Android systems do not use the standard Java API and virtual machine?

123


This training system requires use of the Java Virtual Machine JVM?

True


What type of java used in java enable phone?

J2ME - Java 2 Micro Edition is generally used in java enabled phones. Simple Java Applications use JVM(Java Virtual Machine) for generating bytecode where as Java Mobile Applications use KVM(KiloByte Virtual Machine) for the same purpose. Reason for this is KVM occupies small amount of memory and hence can be embedded inside a java enabled phone easily.


What is the virtual machine system?

Java virtual machine


Where would one find more information on the Java Virtual Machine?

One could find more information about the Java Virtual Machine online on various websites such as 'Wikipedia', 'Java-Virtual-Machine' and of course the website 'Java'.


What is the use of providing jre?

The JRE refers to Java Runtime Environment... JRE is an implementation of the Java Virtual Machine which actually executes Java programs. Without the JRE we cannot execute our Java programs.


Why and amp How is Java is Better For What if your Enterprise Application?

Java is defined by a specification and consists of a programming language, a compiler, core libraries and a runtime (Java virtual machine) The Java runtime allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine. The Java platform is usually associated with the Java virtual machine and the Java core libraries.


What is difference between jvmjre and jdk?

JVM Stands for Java Virtual Machine. JVM is the virtual machine in which a java program gets executed. JRE stands for Java Runtime Environment. JRE is the runtime set up that is required by the JVM to execute java programs. JDK stands for Java Development Kit. JDK is the basic software that gets downloaded from sun's java website if anyone wants to use java.


How do you create a virtual machine on a computer?

Download virtual box by java


Who create Java and when?

Who create Java & when? Why he create java ? What are mane functions of it?


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.