Return keyword

Return keyword

how do we use return in methods?

View Answers

February 24, 2011 at 11:34 AM

Java use of return keyword

import java.util.*;
public class ReverseString{
    public static String reverse(String st){
        String rev = new StringBuffer(st).reverse().toString();
        return rev;
    }
    public static void main(String[]args){
        Scanner input=new Scanner(System.in);
        System.out.println("Enter string: ");
        String str=input.nextLine();
        System.out.println("Reverse: " + reverse(str));
    }
}

For more information, have a look at Return Keyword

Ads









Related Tutorials/Questions & Answers:
Return keyword
Return keyword  how do we use return in methods?   Java use of return keyword import java.util.*; public class ReverseString{ public... at Return Keyword
Return Java Keyword
Return Java Keyword       The return is a keyword defined in the java programming language. Keywords... in java programming language likewise the return keyword indicates the following
Advertisements
Keyword - this
Keyword - this       A keyword is a word having a particular meaning to the programming language. Similarly, this keyword is used to represent an object constructed from a class
The void keyword
The void keyword       The void is a keyword defined in the java programming language. Keywords... programming language likewise the void keyword indicates the following
super keyword
super keyword  super keyword explain
The if Keyword
The if Keyword         The if is a keyword, which is used to perform the selection... that are executed in case, the test condition specified by the if keyword evaluates
final keyword
final keyword  why is final keyword used in java
The for Keyword
The for Keyword       The for is Java keyword that is used to execute a block of code... statement increments the value of i by one. The for keyword may not be used
void Java Keyword
. -- The void keyword in java programming language is often used as the return type... void Java Keyword       The void is a keyword defined in the java programming language. Keywords
SQL as Keyword
SQL as Keyword      ... keywords like, create table keyword is used to create a table Stu_Table... or rows to the respective tables. The select statement return you the record
static keyword
static keyword  please give some detail about Static keyword.   Static Variables Static variables are class variables that are shared by all instance of class .. 1)It is a variable which belongs to the class
super Java Keyword
super Java Keyword       The super is a keyword defined in the java programming language... to a compiler in java programming language likewise the super keyword indicates
The final Keyword
The final Keyword       The final is a keyword. This is similar to const keyword in other languages. This keyword may not be used as identifiers i.e. you cannot declare
What it will return ..... ?
What it will return ..... ?   import java.util.*; public class Name { private final String first, last; public Name(String first, String last...) { if (!(o instanceof Name)) return false; Name n = (Name)o; return n.first.equals
this java keyword
this java keyword       "this" is a keyword defined in the java programming language. Keywords... in java programming language likewise the this keyword indicates the following
transient keyword - Java Beginners
transient keyword  what is transient keyword in java.? plz explain with example
why using static keyword
why using static keyword  why using static keyword
The While keyword
The While keyword       While is a keyword defined in the java programming language. Keywords... programming language likewise the while keyword indicates the following
The volatile keyword
The volatile keyword       The volatile is a keyword defined in the java programming language. Keywords.... The volatile keyword is mostly used to indicate that a member variable
static keyword in interface
static keyword in interface  Could any one explain,why static keyword implict (or explict ) come in interface? I asked lot of persons about this question, but nobody did not answered clearly. please explain clearly and say what
The extends keyword
The extends keyword In this section you will learn about extends keyword in java. The extends is a keyword in java which is used in inheritance. It is used to specify super class in a class declaration. Using this keyword a subclass
use of return statement
use of return statement  what is the use of return statement
uikeyboard disable return key
uikeyboard disable return key  uikeyboard - hot to disable return key
How to use this keyword in java
How to use "this" keyword in java       The keyword this is useful when you need to refer to instance of the class from its method. The keyword helps us to avoid name
function to return value in java
function to return value in java  How to return maximum value in java?   Return Value in Java
The float Keyword
The float Keyword         The float is a Java keyword that may not be used as identifiers i.e..... It is used to declare a variable, an expression or a method return value of type
Java final Keyword Example
Java final Keyword Example In this section we will read about the final keyword in Java in various context. final keyword in Java can be used with the class name, method name, and variable name. Whichever, the final keyword is used
The byte Keyword
The byte Keyword       The byte Java Keyword defines the 8-bit integer primitive type.  The keyword byte in Java is a primitive type that designates with eight bit signed
The long keyword
The long keyword       long is a keyword in java that is used to store 64-bit integer (Java primitive... relevant to a compiler. The keyword long in java is also used to declare
The int keyword
The int keyword       The int is a keyword in java that is used to define 32-bit signed integer... specific meaning relevant to a compiler. The keyword int in java programming language
Super - keyword
Super - keyword       super keyword super is a keyword in java that plays an important role in case of inheritance. Super keyword is used to access the members of the super class. Java

Ads