77 976
Assignments Done
Successfully Done
In August 2019

Answer to Question #25341 in Java | JSP | JSF for hly

Question #25341
What "RETURN" statement and How to use "RETURN" statement in Java when public a method or class ?
Expert's answer
There are two ways to use this return: 1)we can return the methodthat is method executes a block and returns (in any case, something will
return. The only question that you need or what that is)

public static String getText (int index) {
return"Hello World". substring (index); }

public static void main(String[] args)
Stringtext=getText(0);//getText(0) returns "Hello World"
System.out.println( text);//prints result }

2) in the second case we can use return to "undo" ablock.example

void setText ()
if (foo) return;
this.text ="Hello World";

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions