answersLogoWhite

0

What is the return type of finally method in java?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

The final and finally keywords have no impact on the return type of a method in Java.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the return type of finally method in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is default return type for method in java?

default return type is : true


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.


What is the return keyword in Java?

this is the type of the value that the method returns to its caller


Can the return type of a method be an array?

Depends on the language. For Java, yes.


Why use void in main of java?

No. void is not a data type. It is mandatory for all java methods to return something and if it is not going to return anything, we have to mark the method with a "void" return type to let the JVM know that it must not expect anything from the method.


Why should the java main method has the return type as void?

A void method is one that returns no value. The Java main() method is the first method to be called, therefore it doesn't need to return a value to another Java method, therefore it is declared as void. If something needs to be returned to the operating system, this is done differently, not by "returning a value" in the sense of Java.


How do you return an object in java?

With the command return, followed by an object variable. In the method header, you have to declare the return type as the class of the object.


Can return statement be in a void method in java?

the main method in java is the client code therefore doesn't return any values Unlike languages like C/C++, the user doesn't specify an error return code by returning from the main method. Instead they should use System.exit(code) to do this. If the Java main method returns, the default code of zero is returned.


How can you return an array from a method in Java?

You can do this by returning it just like any other data type. int[] f() { return new int[0]; }


Is 'void' a data type in java?

No. The void keyword is used to signify that a method will not return any objects. For example, if you type in "double", you'll need a return statement that has a double. So "void" means that there will be nothing returned.


Why constructor in Java doesn't have any return type?

The constructor of a Java class is not an ordinary method. Its purpose is not to return any value. The purpose of the constructor is to instantiate the class which it does. Since, the purpose of a constructor is only to instantiate and initialize its class and not anything else, it does not have a return type. All it does is creates an object of that class.


What are return statements in java?

you can understand what is the purpose of return in java after this simple example Basically return use in java to return some values from a method note: this sample will work on all java versions, i test it on JDK 1.4 enjoy the code. file name : Class1.java ----- package mypackage1; //package name public class Class1 //class name + file name the { public String add(int a,int b) //a method in the class; its type is String and it take a and b variables; a and b are int { int answer = a+b; //this is some code in the class; maybe some operations; no need to know whats happening in this method System.out.println("I'm in Class1"); //this is some code in the class; maybe some operations; no need to know whats happening in this method return " I'm the returned value "+ answer; ////this is what you need to take from the method } public static void main(String [] arg) { Class1 c1 = new Class1(); //creating c1 object from Class1 Class System.out.println(c1.add(10,6)); //printing the returned values from the method; } } ----------------- output: I'am in Class1 I'am the returned value 16