Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

Java return statement

  • • Return statement in used to explicitly return from a method. Return causes program control to transfer back to the caller of the method.
  • • The return statement immediately terminates the method in which it is executed.

Syntax:
return;

Here is an example to demonstrate
return :

class ReturnDemo {
	public static void main(String[] args) {
		boolean t = true;
		System.out.println("Silan");
		if (t)
			return;
		System.out.println("it will not execute");
	}
}

Output:

Silan

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext