Method in java, Passing Parameters by Value

Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)

978

Program:

 public class ExampleVoidMethod {

   public static void main(String[] args) {
      methodmarks(92.7);
   }

// The void keyword allows us to create methods which do not return a value.

   public static void methodmarks(double marks) {
      if (marks <= 100) {
         System.out.println("Rank:outstanding");
      }else if (marks <= 82.4) {
         System.out.println("Rank:excelent");
      }else {
         System.out.println("Rank:others");
      }
   }
}

Output:

Before swapping, a = 10 and b = 35
Before swapping(Inside), a = 10 b = 35
After swapping(Inside), a = 35 b = 10

**Now, Before and After swapping values will be same here**:
After swapping, a = 10 and b is 35
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.