Return
public class Return{
public static String display() {
return "Inside display"; /*here return type of the method display is
String,so it returns a string value */
}
public static void show(){
System.out.println("Inside show");
return; //returns with no value
}
public static void main(String[] args) {
String message = display();
System.out.println(message);
show);
}
}
Output:
Inside display
Inside show