answersLogoWhite

0


Best Answer

Default values are available for any class or instance variable. If you do not specify a value for a class or instance variable the JVM will provide a default value that will ensure that the system does not end up with any unexpected errors because you used a variable that was not initialized.

Ex:

Public class Test {

int I;

}

In the above class we have just declared an instance variable called 'I' but we haven't associated any value to it. The JVM automatically assigns 0 as the default value to this variable.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the function of default values in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why args0 is used in IntegerparseInt in Java?

It is the default argument name for all Java BIF (Built-In Function)s.


How do I turn Java on?

Install Java. It is "on" by default.


How a class in java declared default?

default it is public type


What are the default values of different primitive types?

The default values for primitive types in Java are the following:Data TypeDefault Valuebyte0short0int0long0Lfloat0.0fdouble0.0dchar'\u0000' (or 0)String (or any object)nullbooleanfalseNote if you use the Object wrappers of primitives (e.g., Byte, Integer, Double, Float, etc.) then like any Object the default value is null.


What happens when no constructor function is declared in a class - in Java?

When any constructor is deffined in your class, the java compiler create a default no argument constructor for you. This constructor only have an invocation to the super class constructor (" super( ) ").


What is default delimiter in java?

\\p{javaWhitespace}+


How many bits does a Java char contain?

16 bits. Java char values (and Java String values) use Unicode.


What is passed toward the method in java?

Java uses pass by value semantics by default.


What is default return type for method in java?

default return type is : true


What is importe mean?

import is a function in java that is used to import data types or values or any functions within a specific class.


Which is java default access specifier?

There is no such thing as an access specifier in Java. There are access modifiers.The default access modifier if unspecified is to allow access to classes in the current package only, except within an interface where the default is 'public'


What is default object in java?

I don't think there is such a thing as a "default object". The default class, for inheritance purposes, is called "Object".