Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Kimani Njoroge
Return keyword
1 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


how do we use return in methods?


Advertisement
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



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
What is this keyword?
What is this keyword?  What is this keyword
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 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
Java keyword
Java keyword  Is sizeof a keyword
super keyword
super keyword  super keyword explain
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
final keyword
final keyword  why is final keyword used in java
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
transient keyword
transient keyword  how to use transient keyword?   Hi Friend, The transient keyword is used to indicate that the member variable should not be serialized when the class instance containing that transient variable
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
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
Dynamic keyword
Dynamic keyword  hi....... What is the dynamic keyword used for in flex? give me the answer ASAP Thanks  Ans: Dynamic keyword... during the run-time. Just add the magic keyword dynamic to the class definition
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
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
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
static keyword with real example
static keyword with real example  static keyword with real examplestrong text
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
why using static keyword
why using static keyword  why using static keyword
transient keyword - Java Beginners
transient keyword  what is transient keyword in java.? plz explain with example
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 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
uikeyboard disable return key
uikeyboard disable return key  uikeyboard - hot to disable return key
use of return statement
use of return statement  what is the use of return statement
function to return value in java
function to return value in java  How to return maximum value in java?   Return Value in Java
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
Return Array in PHP
Return Array in PHP  my question is how to return Array from PHP script
return item in jquery
return item in jquery  How to return items/variables in JQuery?   See the code below to find out how to return an Item in Jquery: function... for the variable item } return item; } var item = findItem(); // do
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
JDialog return value to JDialog ????
JDialog return value to JDialog ????  hello all.... legend. JD1 = JDialog1 JD2 = JDialog2 JD1 open JD2......JD2 has any values, how I return..., true); jd2.setVisible(true); //now I need that JD2 return a value
Advertisements
 

 

 

DMCA.com